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?

2 Answers 2

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;
8
  • thanks for the efforts, but sorry there is another guy answered me first. i wish i could accept more than answer Jul 24, 2014 at 14:26
  • its not for the accept thing :) i saw him before i answered i just wanted to give the extra infos ;)
    – Youness
    Jul 24, 2014 at 14:29
  • Just ""God"" works with the intent. we must deal with facts. I believe you really, but my belief won't increase your reputation :) Jul 24, 2014 at 14:33
  • its ok :) and i dont look to increase it :) btw i see you are learning C# good luck its a good language if you need any help just let me know :)
    – Youness
    Jul 24, 2014 at 14:35
  • Appreciate the help though I hate c# because I'm not good at it. However, this is just a small application. I am a JAVA, Python fan. thanks again Jul 24, 2014 at 14:37
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

4
  • 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 Jul 24, 2014 at 14:22
  • you know what? the center screen helps me, thanks I will accept the answer when the system allows Jul 24, 2014 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. Jul 24, 2014 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, 2014 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.