如何清除图片框上的绘制图像? 以下内容对我没有帮助:
pictbox.Image = null;
pictbox.Invalidate();
请帮忙。
编辑
private void pictbox_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
vl.Draw(g, ref tran.realListForInsert);
}
public void Draw(Graphics g, ref List<double> arr)
{
g.DrawRectangle(new Pen(Brushes.Red, 3), nodeArr[Convert.ToInt32(templstName)].pict.Location.X, nodeArr[Convert.ToInt32(templstName)].pict.Location.Y, 25, 25);
g.DrawRectangle(new Pen(Brushes.Green, 3), nodeArr[Convert.ToInt32(templstArgName)].pict.Location.X, nodeArr[Convert.ToInt32(templstArgName)].pict.Location.Y, 25, 25);
nodeArr[Convert.ToInt32(templstName)].text.Text = arr[Convert.ToInt32(templstArgName)].ToString();
arr[Convert.ToInt32(templstName)] = arr[Convert.ToInt32(templstArgName)];
}
最佳答案
设置Image
property到 null 会工作得很好。它将清除图片框中当前显示的任何图像。确保您编写的代码完全像这样:
picBox.Image = null;
关于c# - 图片框上的清晰图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5856196/