根据桌面调整窗体大小和背景图片

        private void Form1_Load(object sender, EventArgs e)
        {
            int DeskWidth = Screen.PrimaryScreen.WorkingArea.Width;
            int DeskHight = Screen.PrimaryScreen.WorkingArea.Height;
            this.Width = Convert.ToInt32(DeskWidth * 0.8);
            this.Height = Convert.ToInt32(DeskHight * 0.8);
        }

 

        private void Form1_Load(object sender, EventArgs e)
        {

            this.BackgroundImage = Image.FromFile("1.jpg");
            this.BackgroundImageLayout = ImageLayout.Stretch;
        }

  背景图片放在debug文件夹中

 

原文地址:https://www.cnblogs.com/my-cat/p/7205503.html