【发布时间】:2011-08-11 11:49:59
【问题描述】:
是否有关于 WinForms 中绘制周期的文档?
当我在 Windows 中编程时,绘制周期通常是以下形式:
sent a WM_PAINT message
{
call BeginPaint(&paintStruct)
//BeginPaint sends WM_NCPAINT and WM_ERASEBKGND
sent a WM_ERASEBKGND message
{
i can:
- allow default processing (Windows will fill the area with the default background color (e.g. white)
- erase and background myself (e.g. a gradient) and prevent default processing
- do nothing (letting whatever was there before me stay there) and prevent default processing
}
perform whatever painting i desire on
paintStruct.hDC (Device Context)
paintStruct.rcPaint (Invalid Rectangle)
that was populated into paintStruct during BeginPaint
call EndPaint()
}
这一切都记录在 MSDN 上:Windows Development\Graphics and Multimedia\Windows GDI\Painting and Drawing\About Painting and Drawing
我找不到任何关于 WinForms 及其绘制周期的此类文档。我可以随机找到名称为 paint 的方法和事件:
-
OnPaint(受保护的方法“引发 Paint 事件。”) -
OnPrint(受保护的方法“引发 Paint 事件。”) - InvokePaint(受保护的方法“引发指定控件的 Paint 事件。”)
-
Paint(公开活动) -
InvokePaintBackground(受保护的方法“引发指定控件的 PaintBackground 事件。”) -
OnPaintBackground(受保护的方法“绘制控件的背景。”)
注意:忽略没有
PaintBackground事件的事实
是否有描述这些实体之间设计关系的文档? WinForms 中是否有关于绘制周期的文档?
【问题讨论】: