简体   繁体   中英

How to develop win form application for the system with the resolution of 1080*1920

I want to develop a windows form application where the destination system is having screen resolution of 1080x1920. but my system is not accepting that resolution . even i cant set my winform size to 1080x1920. can anybody help me out to solve this problem

This works for me. This is the Load event for the form (you can generate this by double clicking the form in the designer). In this event we check the current dimensions of the screen containing the form. Then we set the form size to match. We also move the form's position to 0, 0 so it doesn't clip off the screen.

    //the name of this function will be different for you.
    //generate this function by double clicking the form in designer.
    //the code inside the function is what you're interested in.
    private void MainForm_Load(object sender, EventArgs e)
    {
        Rectangle screenSize = Screen.GetBounds(this); //find out the current screen size
        this.Top = 0; //move the form to top
        this.Left = 0; //move the form to left
        this.Width = screenSize.Width; //set form width to screen width
        this.Height = screenSize.Height; //set form height to screen height
    }

EDIT: Also, why not just maximize?

        this.WindowState = FormWindowState.Maximized;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM