Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Resizing Forms.UserControl in a DockPanePlugin

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
688 Views, 3 Replies

Resizing Forms.UserControl in a DockPanePlugin

Hi there,

I am using a UserControl as a PlugIn in Navisworks 2012 (based on the BasicDockPanePlugin example). When the size of the host window is changed the UserControl does not respond.

How can I dock the UserControl to the host window or subscribe to an event that is fired when the window is resized?

Kind regards,

Gregor

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

ok. figured it out. for (my own) future reference:

 

//subscribe to the SizeChanged event of the parent of the UserControl which is of type Forms.Panel

Panel hostPanel= (Panel)this.Parent;
hostPanel.SizeChanged += new EventHandler(hostPanel_SizeChanged);

 

//size controls to taste when the event is raised

void hostPanel_SizeChanged(object sender, EventArgs e)
{
anyControl.Width = this.Parent.Width - 5;
}

Message 3 of 4
NatCad74
in reply to: Anonymous

Hi I'm trying to achieve this as well however I am getting null value on (Panel)this.Parent;

 

I'm trying to set this in the Load is this where you are running it from?

 

Cheers

Message 4 of 4
NatCad74
in reply to: NatCad74

I worked it out

 

 protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);

            _hostPanel = (Panel)Parent;
            _hostPanel.SizeChanged += (hostPanel_SizeChanged);
            ResizeControl();
        }


        private void hostPanel_SizeChanged(object sender, EventArgs e)
        {
            ResizeControl();
        }

     
        public void ResizeControl()
        {
            Width = _hostPanel.Width;
            Height = _hostPanel.Height;
        }

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report