新人求教:Graphics.save()和Graphics.Restore()调用的问题
我重载了OnPaint方法在FORM上绘图,绘制完成后调用Graphics.save()保存,然后在按键触发函数中调用Graphics.Restore()还原,但是每次点击按键时,都会出现异常,异常是未处理ArgumentException,代码如下:protected override void OnPaint(PaintEventArgs e)
{
g = e.Graphics;
/*绘图*/
transState = g.Save();
}
private void button4_Click(object sender, EventArgs e)
{
g.Restore(transState);
}