Moving Panel at Run Time

  • Thread starter Thread starter pregis
  • Start date Start date
P

pregis

Hi.. is there a way for me to manipulate the location of a panel within a
form at run time? I tried panel1.location.x = 5 but that doesn't seem to
work.

Thank you in advance for any help you can provide.
 
pregis said:
Hi.. is there a way for me to manipulate the location of a panel within a
form at run time? I tried panel1.location.x = 5 but that doesn't seem to
work.

Thank you in advance for any help you can provide.

panel1.left = 5

or

panel1.location = new point(5, panel1.top)



Armin
 
Try Panel1.Left and Panel1.Top instead. Be aware that if your panel is
docked, these settings won't have any effect.
 
Both Armin and I should also have pointed out that "Location" is a Point,
which is a value type rather than a reference type. If you're new to .NET
then I recommend reading up on the difference and understanding why
Panel1.Left does work while Panel1.Location.X does nothing.

HTH,
Alex
 
Back
Top