Home > Net >  Winform picturebox control problem for help
Winform picturebox control problem for help

Time:09-19

Bosses I have a question, that is, I use a button to click on things to dynamically generate some picturebox control, when I drag and drop to move two overlapping picturebox control, to trigger a paint event, leading to the inside of the picturebox graphics change, I want to how to solve?

CodePudding user response:

, help me

CodePudding user response:

Bitmap b=new Bitmap (pictureBox2. Width, pictureBox2. Height);
Graphics g=Graphics. FromImage (b);
G.F illRectangle (new SolidBrush (Color Red), 0, 0, 100, 100);
G.D ispose ();
PictureBox2. Image=b;

CodePudding user response:

refer to the second floor WQR1994 response:
Bitmap b=new Bitmap (pictureBox2. Width, pictureBox2. Height);
Graphics g=Graphics. FromImage (b);
G.F illRectangle (new SolidBrush (Color Red), 0, 0, 100, 100);
G.D ispose ();
PictureBox2. Image=b;

Excuse me is written in the paint event

CodePudding user response:

refer to the second floor WQR1994 response:
Bitmap b=new Bitmap (pictureBox2. Width, pictureBox2. Height);
Graphics g=Graphics. FromImage (b);
G.F illRectangle (new SolidBrush (Color Red), 0, 0, 100, 100);
G.D ispose ();
PictureBox2. Image=b;

Is written in the paint event? I have just changed or not
  • Related