C # set the specific position when the window starts to be displayed,
When I start to set the specific position of the window, I can only directly set the position to CenterScreen by setting the StartPosition in the windows attribute. This is quite convenient and can be directly centered.
However, another problem occurs later, that is, my other forms. I want to specify a specific position for the form to appear. After checking for a long time, I realized that the Manual of StartPosition was born for this!
# Region set the window position based on the screen resolution // get the display screen width int xWidth = SystemInformation. primaryMonitorSize. width; // obtain the display height int yHeight = SystemInformation. primaryMonitorSize. height; // calculate the length and Height of the login interface in the center (minus half of the length and Height of the form) login_1.Location = new Point (xWidth/2-199, yHeight/2-153); # endregion
In this case, you must first select the StartPosition In the attribute as Manual to customize the start position;
Second, you need to add Using System. Drawing to reset the position of the Drawing.