set object center in the form

  • Thread starter Thread starter Grey
  • Start date Start date
G

Grey

I need to set the Tab Control object to center in the form. When I click the
maximize button in the form, the Tab control object would not be position
in the center. My question is how to set the object center in the position
whatever the size of the form..


Millin thanks
 
hi
place the Tab Control object to center in the form.change the anchor
property of tab control to Top, Bottom, Left, Right

regards
Ansil
Dimensions
Technopark TVM
(e-mail address removed)
 
Assuming you don't want the tab control to resize itself when the for
resizes (which using the anchor settings would do) you could to the
following in the resize event of the form (watch for word wrap):

if (this.WindowState != FormWindowState.Minimized)
{
if (this.tabControl1.Width < this.Width)
{
this.tabControl1.Left = (this.Width - this.tabControl1.Width)/2;
}
if (this.tabControl1.Height < this.Height)
{
this.tabControl1.Top = (this.Height - this.tabControl1.Height)/2;
}
}

Hope this helps.

Have A Better One!

John M Deal, MCP
Necessity Software
 
Back
Top