【发布时间】:2012-06-28 13:54:26
【问题描述】:
我有以下绘制矩形的绘制事件(表单):
void LogicSimulationViewerForm_Paint(object sender, PaintEventArgs e) {
Rectangle rect = new Rectangle(100, 100, 400, 100);
Graphics c = rtbLogicCode.CreateGraphics();
c.DrawRectangle(new Pen(Color.Black, 3), rect);
}
矩形显示片刻,然后立即消失。矩形只会在用户调整表单大小时再次显示。
我该如何解决这个问题?
【问题讨论】:
-
您需要在使用 Pen 后进行 Dispose()。或者使用普通笔。