Click here to Skip to main content
13,141,637 members (50,110 online)
Rate this:
Please Sign up or sign in to vote.
How to set a Window properties or code, to open window form to right side of screen and full size from top to bottom and little less whatever i want.
Can anybody help me to resolve this problem.
Posted 17-Sep-12 21:15pm
Namit KB1.3K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Set the StartPosition property to Manual. Use the Load event to change the position, the earliest you'll know the actual size of the window:

public partial class Form1 : Form
    public Form1()
        this.StartPosition = FormStartPosition.Manual;
    private void Form1_Load(object sender, EventArgs e)
        Screen scr = Screen.FromPoint(this.Location);
        this.Location = new Point(scr.WorkingArea.Right - this.Width, scr.WorkingArea.Top);

Namit KB 18-Sep-12 4:22am
Thanks for your help, but what is this working area its giving me error...

Error8 : 'object' does not contain a definition for 'WorkingArea' and no extension method 'WorkingArea' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Mario Majčica 18-Sep-12 4:24am
Sorry, check the edit, my copy paste error. I tried the code above and it is working properly.

Namit KB 18-Sep-12 4:28am
Oh...i solved this...through your help thank u..but its coming..Like top----right, it is better if i will get middle ---right
Mario Majčica 18-Sep-12 4:31am
Then modify the location in this way:

this.Location = new Point(scr.WorkingArea.Right / 2, scr.WorkingArea.Top);

It is a simple calculation, WorkingArea gives you the screen positions, and with that you can calculate the point where you want to show your form.

Namit KB 18-Sep-12 4:43am
Thanks for ur help..But still its coming in top---right and not coming in middle---right.
Mario Majčica 18-Sep-12 4:44am
You had just asked that: "it is better if i will get middle ---right". Can you explain exactly where and how you would like to put this form on the screen??? Make a picture and post the link! :)

Namit KB 18-Sep-12 5:00am
Please visit the link :-- ""
Mario Majčica 18-Sep-12 5:09am
Try with this:

this.Location = new Point(scr.WorkingArea.Right - this.Width, (scr.WorkingArea.Bottom - this.Height) / 2);

And don't forget to accept and vote the answer ;)

Namit KB 18-Sep-12 5:30am
Thanks a lot, it works as i was looking...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100