0

I am stumped on this problem. I have an image that is in Panel1 of the form's SplitContainer. The image is a TIFF file that is contained in the "old" Kodak Image Control (axImgEdit1). When the form is opened the image is properly displayed, but when you maximize the form by clicking the "max icon" (upper left corner of form), the image doesn't resize and fill Panel1. Everything resizes except the image which stays its original size!

This normally works. I have another program that uses the same code to display a TIFF image and the image resizes correctly to fill the max form. I've checked my code and everything is identical!

Here's the code to display the image:

axImgEdit1.Image = currentPath;
axImgEdit1.DisplayScaleAlgorithm = ImgeditLibCtl.DisplayScaleConstants.wiScaleOptimize;
//this.Dock = DockStyle.Fill;
axImgEdit1.FitTo(0);
axImgEdit1.Display();

I tried the "this.Dock = DockStyle.Fill" but it didn't help. I tried removing the Kodak Image Control and reloading it but no fix. I've triple-checked the other program and the code AND control settings are identical!

Any ideas would be greatly appreciated.

Thanks, Bob

Bob T
  • 413
  • 2
  • 8
  • 17
  • 1
    Software does not behave like fine wine, it doesn't get better when it ages. This is an 18 year old control from a company that's bankrupt. Better cut your losses. – Hans Passant Jan 24 '13 at 19:13

1 Answers1

0

I have found a way to solve the problem. I'm still not sure why identical code from two programs behaves differently. So my solution uses the Form_Resize event. For this problem the form being Maximized is "ViewDwg". I am only worried about the Maximize state and not the Minimize state. I commented out the line "if (ViewDwg.ActiveForm.WindowState == FormWindowState.Maximized)" because it would hang on the line during testing. It works fine without it.

private void ViewDwg_Resize(object sender, EventArgs e)
    {
        //if (ViewDwg.ActiveForm.WindowState == FormWindowState.Maximized)
        //---this is used to maximize the dwg when user clicks on the Form's maximize icon in the upper right corner of the form (ViewDwg) //---added 1-25-13   
        axImgEdit1.DisplayScaleAlgorithm = ImgeditLibCtl.DisplayScaleConstants.wiScaleOptimize;
        axImgEdit1.FitTo(0);
        axImgEdit1.Display();
    }
Bob T
  • 413
  • 2
  • 8
  • 17