By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,855 Members | 1,988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,855 IT Pros & Developers. It's quick & easy.

Programatically positioning control on form

P: n/a
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!
Aug 26 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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]
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:12**********************************@microsof t.com...
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!

Aug 29 '05 #2

P: n/a
That helps me get the control positioned in the top, left of the form, but
what about positioning the control elsewhere in the frame? Am I stuck with
fiddling with coordinate math?

"Mona" wrote:
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]
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:12**********************************@microsof t.com...
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!


Aug 30 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.