I have a tabpage and a panel inside this tabpage. When I insert anything to panel I want to center tabpage's scrollbar because I insert anything center of this tabpage but TabPage Scrollbar place on left.Can you explain that how I code that???
how can I reach height of scrollbar(tabpage's autoscroll)????
http://www.resimupload.com/ds794669779_prog.html
Loading
ManuelPosted Aug 1, 2007, 5:48 PM
TabPage
page = new TabPage( );page.AutoScroll =
true; Button btn = new Button( );btn.Text =
"Add label";btn.Click +=
delegate{
Label lbl = new Label( );lbl.Location =
new Point( 0, 100 );lbl.Anchor =
AnchorStyles.Left;lbl.AutoSize =
false;lbl.Width =
this.Width + 400;lbl.BackColor =
Color.Red;lbl.TextAlign =
ContentAlignment.MiddleCenter;lbl.Text =
"centered text";page.Controls.Add( lbl );
if ( lbl.Width > page.Width ){
page.AutoScroll =
false;page.HorizontalScroll.Value = ( page.HorizontalScroll.Maximum - page.HorizontalScroll.LargeChange ) / 2;
page.AutoScroll =
true;}
btn.Dispose( );
};
TabControl tabCtrl = new TabControl( );tabCtrl.Dock =
DockStyle.Fill;tabCtrl.TabPages.Add( page );
this.Controls.Add( btn ); this.Controls.Add( tabCtrl );