Hi,
I have groupBox on my form that i would like to move up or down as i slide on the Scroll bar but i cant find how to set the groupBox location.. I have tride such code as listed below:
//Just set the location
groupBox1.Location = 55,22;
//Set Y of groupBox with value from vScrollBar
groupBox1.Location.Y = vScrollBar1.Value;
Any Ideas?
Thanks
Shane
Scott LyslePosted Jun 27, 2008, 10:29 AM
With a form with a groupbox and a vertical and horizontal scrollbars (docked to the right and to the bottom) (just figure out the starting position part):
public Form1()
{
InitializeComponent();
hScrollBar1.Maximum = this.Width;
vScrollBar1.Maximum = this.Height;
}
private void hScrollBar1_Scroll(object sender,
ScrollEventArgs e)
{
groupBox1.Left = hScrollBar1.Value;
}
private void vScrollBar1_Scroll(object sender,
ScrollEventArgs e)
{
groupBox1.Top = vScrollBar1.Value;
}