Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8524

Control with responsive GUI

$
0
0

@victormunoz wrote:

I have a control with a GUI. But the control is displayed always with the same size.
When the user resizes the widget, it doesn’t react to it, even if I put anchor or resizing functions.
Here is the code I am using:

public MyPlugIn()
{
Instance = this;
}

    public static MyPlugIn Instance
    {
        get; private set;
    }

    protected override LoadReturnCode OnLoad(ref string errorMessage)
    {
        Rhino.UI.Panels.RegisterPanel(this, typeof(Forms.MainControl), "Main", Properties.Resources.icon);
        return base.OnLoad(ref errorMessage);
    }

    public void TooglePanel()
    {
        if (Rhino.UI.Panels.IsPanelVisible(Forms.MainControl.GetGUID()))
            Rhino.UI.Panels.ClosePanel(Forms.MainControl.GetGUID());
        else
        {
            Rhino.UI.Panels.OpenPanel(Forms.MainControl.GetGUID(), true);
            var panel = Rhino.UI.Panels.GetPanel<Forms.MainControl>(Rhino.RhinoDoc.ActiveDoc);
            panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            panel.Resize += Panel_Resize;
        }
    }

    private void Panel_Resize(object sender, System.EventArgs e)
    {
        MessageBox.Show("Control resized");
    }

The resize event never fires, and the anchors don’t seem to change anything.
What should I add in order to make this control responsive?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8524

Trending Articles