2

I made a simple program with two forms. the first form is small, the second one is large.

I already handled the screen resolution thing so the scroll is working and I tested the application on many screen sizes and resolutions.

my problem is this:

when I go from the first form to the second form, the second form doesn't start from the top left of the screen so the result is this: enter image description here

I have to drag it to the top to see the two buttons at the bottom like this: enter image description here

my question is: is there a way to make this form starts as in the second image, not the first one?

Agnieszka Polec
  • 1,471
  • 6
  • 20
  • 26

2 Answers2

2

There is a proprety called StartPosition with it you can define the startup position of a form

PS : if you want a costum position for exemple if you wan it to be in the coordinate : X=15 and Y =20 in the FormLoad Event (double click the form ;) ) put this :

Form1.Location = new Point(15, 20);

OR THIS :

Form1.Top=20;
Form1.Left=15;
Youness
  • 1,468
  • 1
  • 9
  • 19
1

Forms.StartPosition is the property to work with.

Usually setting it to CenterParent or CenterScreen should work well for your requirement.
Instead if you want to fine tune the position of the form then you should set the property to Manual and then work with the Location property (a Point structure) calculating the correct location desidered.

Also, keep in mind that if you want to manually work with Location and Size of the form you should do it overriding the OnLoad event, as explained in this question

Community
  • 1
  • 1
Steve
  • 213,761
  • 22
  • 232
  • 286
  • I went to the property of the form and changed the start position to center parent but still the same problem , the cancel and save buttons doesn't appear until i drag the form up – Agnieszka Polec Jul 24 '14 at 14:22
  • you know what? the center screen helps me, thanks I will accept the answer when the system allows – Agnieszka Polec Jul 24 '14 at 14:23
  • @Youness oh you are the same guy who answered me in my previous quesiton right? sorry really sorry, in both cases I couldn't accept yoru answer, but when I have enough reputations, I will upvote your answers. – Agnieszka Polec Jul 24 '14 at 14:29
  • dont worry i dont care about the votes and stuff :D i just like to help as i can :) – Youness Jul 24 '14 at 14:31