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

        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文件夹中

 

posted @ 2017-07-19 14:10  mCat  Views(217)  Comments(0Edit  收藏  举报