我想让picturebox的图片上被一个矩形覆盖,矩形是浅灰色的,透明度就算30吧,这个我会做,
Rectangle all_rect = new Rectangle(0, 0, pictureBox2.Width, pictureBox2.Height);
SolidBrush brush3 = new SolidBrush(Color.FromArgb(30, Color.Gray));
gra.FillRectangle(brush3,all_rect);但是之后我想让这个浅灰色的矩形框中间留出来几个矩形区域(比如Rectangle rect1,rect2)不覆盖浅灰色,
保持图片原来的颜色,我怎么办啊?
Rectangle all_rect = new Rectangle(0, 0, pictureBox2.Width, pictureBox2.Height);
SolidBrush brush3 = new SolidBrush(Color.FromArgb(30, Color.Gray));
gra.FillRectangle(brush3,all_rect);但是之后我想让这个浅灰色的矩形框中间留出来几个矩形区域(比如Rectangle rect1,rect2)不覆盖浅灰色,
保持图片原来的颜色,我怎么办啊?
Rectangle all_rect = new Rectangle(0, 0, pictureBox2.Width-1, pictureBox2.Height-1);
SolidBrush brush3 = new SolidBrush(Color.FromArgb(30, Color.Red));
GraphicsPath gp = new GraphicsPath();
gp.AddRectangle(all_rect);
Rectangle rec1=new Rectangle(40,30,40,50);
gp.AddRectangle(rec1);
rec1 = new Rectangle(100, 120, 66, 77);
gp.AddRectangle(rec1);
e.Graphics.DrawPath(new Pen(brush3), gp);
e.Graphics.FillPath(brush3, gp);