我想做一个截屏后可编辑的功能,但是画矩形想要预览功能
Graphics g = pictureBox1.CreateGraphics();
x2 = e.X;
y2 = e.Y;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
if (x > x2)
{
string a = textBox1.Text;
int b = Convert.ToInt32(a);
g.DrawRectangle(new Pen(colorChoosed, b), new Rectangle(e.X, e.Y, x - x2, y - y2));
}
else
{
string a = textBox1.Text;
int b = Convert.ToInt32(a);
g.DrawRectangle(new Pen(colorChoosed, b), new Rectangle(x, y, x2 - x, y2 - y));
}
会显示很多矩形
我试过在截一次控件,然后贴上去,但没用
画矩形想要预览功能
绘制应在pictureBox1 的Paint 事件处理中进行