protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.DrawCircle(...);
}
或者,将以下方法委托至 Form 的 Paint 事件:private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.DrawCircle(...);
}
另外,如果使用了以下语句
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint,true);那么 OnPaint 可能就无效了。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货