Programatically positioning control on form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using Visual studio 2003 and VB.NET, I want to programatically position a
control (windows media player) on my form. For example, I want to position
the control in 1 of 9 locations: topLeft, topCenter, topRIght, leftCenter,
center, rightCenter, bottomLeft, bottomCenter, bottomRight.

Is there an easy way to ask the container to place the control in one of
these places? I assume I can do coordinate math - getting bounds from the
form but I was hoping to avoid that.

After placing the control on the form, I know that I'll need to set its
anchor property so that it can keep its relative position. Is there something
slick that I can do with the Dock property?

Any help would greatly be appreciated!
 
Hi,
How are you doing?
To achieve this try using the top, left property of the Control(media
player)

You may place this control based on the container form's top left, height
and width.

Me.Button5.Top = Me.Top
Me.Button5.Left = Me.Left

I hope this is helpful.


Thanks
Mona
[Grapecity]
 
Back
Top