Question How to invalidate / update VS IDE constructor for C #?

I have a CustomForm inherited from Form that implements a boolean property called Prop . The forms that I will use inherit from CustomForm . This property will make some picture and change (if included) in the form. However, this does not work properly, the designed VS IDE is not updated to show the changes. But if I press Ctrl + Shift + B (Menu: Build "Build Solution), the VS IDE is updated, the form designer will even disappear within a second of a second and will be redrawn with new changes.

So, is there a way, by code, to force the VS IDE designer to update themselves in the same way as when building a solution? If so, I could add this code to the Prop element , and my problem disappeared.

Note that I tried calling Invalidate (), Refresh (), and Update. But none of them seemed to solve the problem ...


Here is a little understanding of my real problem. My code looks something like this:

internal class MyForm : Form {
    private FormBorderStyle formBorderStyle;
    private bool enableSkin;

    [DefaultValue(false)]
    public bool EnableSkin {
        get {
                return enableSkin;
        } set {
                enableSkin = value;

                if(enableSkin) {
                        BackColor = Color.Lime;
                        MaximizedBounds = Screen.GetWorkingArea(this);
                        TransparencyKey = Color.Lime;

                        base.FormBorderStyle = FormBorderStyle.None;
                } else {
                        BackColor = SystemColors.Control;
                        MaximizedBounds = Rectangle.Empty;
                        TransparencyKey = Color.Empty;

                        base.FormBorderStyle = FormBorderStyle;
                }
        }
    }

    [DefaultValue(FormBorderStyle.Sizable)]
    public new FormBorderStyle FormBorderStyle {
        get {
                return formBorderStyle;
        } set {
                formBorderStyle = value;

                if(EnableSkin) {
                        base.FormBorderStyle = FormBorderStyle.None;
                } else {
                        base.FormBorderStyle = formBorderStyle;
                }

        }
    }

    internal MyForm() {
        EnableSkin = false;
        FormBorderStyle = FormBorderStyle.Sizable;
    }
}

And the problem I am facing looks something like this: http://blogs.msdn.com/calvin_hsia/archive/2007/05/01/windows-vista-aero-borderstyle-paint-problem-as-non-administrator. aspx

, EnableSkin True, False, , FormBorderStyle, , . , VS .

VS IDE. , , , , , .


?

:

public class MyForm : Form { }

, ... Invalidate(), , .

+3
3

- . ReCreateHandle(), EnableSkin false. :)

, :)

+4

, , :

 [Description("Description of your property."), NotifyParentProperty(true),
 RefreshProperties(RefreshProperties.Repaint)]

IDE .

+2

, IDE, , . , , , ... , .

, , .

... this.Invalidate(), .

, !

0
source

All Articles