今天在反编译.net framework的时候,发现Control有个Region属性,查了一下文档,定义是:The window region is a collection of pixels within the window where the operating system permits drawing. The operating system does not display any portion of a window that lies outside of the window region. 也就是操作系统只显示Region里的区域,而且,它并不接受Region以为的区域的Mouse事件。
.net framework 的design-time的Selected UI正是由它来实现的。在design-time下,一个Control被选中后,会有一个选中框,鼠标移上去后,会有Resizable或Moveable的效果。在DesignFrame上覆盖了一个透明的Control,Control的Region是所有被选中的Controls的选择框区域,由这个Control负责绘制选择框,并处理选择框区域的Mouse事件。