duck
duck

Reputation: 857

Custom control resizes after project build

Here is the control at design time. As you can this is how it is supposed to look.

enter image description here

At runtime....

enter image description here

And design time again after I run the program and close it.

enter image description here

It's weird because if I run the program again the textboxes resize correctly at runtime but at design time they shrink.

The only custom code for this is setting the image, which is this:

    [Description("The image to appear next to the textbox. Image will be resized to 16x16.")]
    public Image StatusImage
    {
        get { return pictureBox.Image; }
        set { pictureBox.Image = value; }
    }

I am handling the resize of the control by setting the textbox Anchor property to Top, Left, Right and the picturebox Dock property is set to right. It all seems to work fine until I run the program. Then the design view is messed up. Any ideas why?

Upvotes: 0

Views: 59

Answers (1)

Zohar Peled
Zohar Peled

Reputation: 82474

It's hard to tell without seeing the code... However I did have a similar problem and found that there was an autoscale property on the control that was set to Font. changed it to None and it solved the problem for me.

Upvotes: 2

Related Questions