Where is the information stored about the exact position of e.g. a button on a form ?

  • Thread starter Thread starter Mark Poppers
  • Start date Start date
M

Mark Poppers

Assume I position a button on a Form on position (x,y)=20,75pixel

Where (in which file) is this information stored ?

Marl
 
Mark Poppers said:
Assume I position a button on a Form on position (x,y)=20,75pixel

Where (in which file) is this information stored ?

If you are using Visual Studio 2005, the designer writes this
information into the source code in Form1.designer.vb. To see this file from
solution explorer, you will have to click the "show all files" button,
otherwise it is hidden.
 
If you're looking to get the info via code, then you can use the Location
property of the item.

Point p = Button1.Location;
TextBox1.Text = p.ToString();

this will put "{X = 45, Y=45}" in the textbox. If you need to compare the
actual X or Y entry the use p.X or p.Y properties and assign to an int.

HTH

Alberto Poblacion said:
In said:
[...] Form1.designer.vb. [...]

Ooops! I meant, obviously, .cs instead of .vb. Sorry.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top