private void mainform_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            System.Drawing.Bitmap xzfy = new System.Drawing.Bitmap(Application.StartupPath + "//img/背景.png");
            g.DrawImage(xzfy, this.ClientRectangle);
        }
        private void loadBackImage()
        {
            Bitmap bit = new Bitmap(this.Width, this.Height);
            Graphics g = Graphics.FromImage(bit);
           // g.DrawImage(this.pictureBox1.Image, new Rectangle(0, 0, bit.Width, bit.Height), 0, 0, this.pictureBox1.Image.Width, this.pictureBox1.Image.Height, GraphicsUnit.Pixel);
            this.BackgroundImage = bit;
            g.Dispose();
        }

  

    private void mainform_SizeChanged(object sender, EventArgs e)
        {
            loadBackImage();
        }

  

 private void mainform_Load(object sender, EventArgs e)
        {
            loadBackImage();
        }

  

相关文章:

  • 2022-02-01
  • 2021-09-15
  • 2021-04-29
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-12-19
  • 2021-09-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
相关资源
相似解决方案