private void Form5_MouseMove(object sender, MouseEventArgs e)
        {
            int intOX = rectDrawArea.X;
            int intOY = rectDrawArea.Y;
            rectDrawArea.X = e.X;
            rectDrawArea.Y = e.Y;
            Debug.WriteLine(rectDrawArea.ToString());
            //Invalidate();
            MyDrawFun();
        }

        private void MyDrawFun()
        {
            Graphics go = Graphics.FromHwnd(this.Handle);
            Bitmap bitmap = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
            Graphics g = Graphics.FromImage(bitmap);
            g.Clear(System.Drawing.SystemColors.Control);
            g.DrawRectangle(Pens.Red, rectDrawArea);
            Bitmap logo = Properties.Resources.baidulogo;
            g.DrawImage(logo, 0, 0);
            go.DrawImage(bitmap, 0, 0, this.ClientSize.Width, this.ClientSize.Height);
            g.Dispose();
            bitmap.Dispose();
        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2021-06-29
相关资源
相似解决方案