I added a Button on my form, I want to arrange it's location precisely to the pixel on the form. Does anyone know how I can do that? Thanks in advance.

Edited by nicewave: n/a

5 Years
Discussion Span
Last Post by nicewave

Try using the .Top and .Left properties of the control. You can make it relative to the form by using the buttons .Width and .Height members as well as the form's width and height. Although anchoring and docking will keep these ratios even for you.

Edited by skatamatic: n/a


MyButton.Location = new Point(11,11); would position the upper left part of your button at the point 11,11


I'm sorry I didn't make it clear, I want to drag the control pixel at a time, right now when I move the control by dragging the mouse, it move in a large gap.


Not through coding. In the Form Designer, I want to drag any controls but only a pixel right now when I drag it drag in a large gap.


O that. Look in Tools menu Options, under Windows Form Designer General for settings of the Grid, under Layout Settings.


You should be able to move them pixel by pixel by default. However, Visual Studio will try to auto-align it with other controls (middles, tops and bottoms). You can disable this by holding the ALT key while dragging a control.

Votes + Comments
Thanks for the tip!

Thanks guys, that would do it. I remembered I can do that when I was doing VB3 :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.