Search code examples
vb.netdesigner

Showing gridlines of the form and getting the x and y coordinates during design


I'm designing my form using the paint event of the form, my problem is I am having a hard time determining the x and y of specific location, note that I don't want to see the x and y coordinates during run-time, what I want is during design time.

Is it possible to enable some sort of grid lines just like in VB6 and if possible also maybe I can see the x and y coordinates?

During design time my form is empty, then after running it becomes like this

enter image description here

The dot with this is what I want to get.

Is it possible to enable the gridlines during design time that will serve as a guide line? If it can also enable during run-time that would be much better.

It would be also awesome if I can see the x and y coordinates during design time.


Solution

  • Assuming this is a Windows Form you can get a grid similar to what VB6 did. Have to turn it on the option for it (Tools -> Windows Forms Designer -> General -> Layout Settings). Set the "Layout Mode" to "SnapToGrid" and "Show Grid" to True.

    Note you will have to close and reopen any designer you may already have open for it to take effect.