Click here to Skip to main content
15,910,212 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all


I want to fix the position of a form which can't change by the end user.How can i do this?


Please suggest

Thanks in advance.
Posted
Comments
VJ Reddy 21-May-12 8:35am    
Thank you for accepting the solution :)

With the Solution 1 given by Chauhan_Yatin the Form position can be fixed, but the form can still be moved either by dragging with the TitleBar or by using the move menu option of TitleBar short cut menu. As seen from the question, I think, the form is not to be moved by the user. To achieve this the following Code Project article
Immoveable Form[^]
and the following
http://stackoverflow.com/questions/907830/how-do-you-prevent-a-windows-form-being-moved[^]
may be helpful.
 
Share this answer
 
Use LocationChanged event on Form.
and set Position.
C#
private void onLocation_Changed(object sender, EventArgs e)
       {
           this.Location = new Point(150, 100);
       }
 
Share this answer
 
There is properties of form you can set from that or also can make a method for that like this


C#
private void SetFormPosition()
    {
        this.StartPosition = FormStartPosition.Manual;
        this.Left = Screen.PrimaryScreen.WorkingArea.Right - this.Width;
        this.Top = Screen.PrimaryScreen.WorkingArea.Bottom - this.Height;
    }








Thank You....
 
Share this answer
 
Comments
bhagirathimfs 13-Apr-12 2:46am    
Actually i fixed the position but the end user is dragging the window to another position.i want to fix that position such that the end user can't change the position of the form means the end user can't select the form.


Thanks
VJ Reddy 13-Apr-12 2:56am    
Please see Solution 2.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900