指定控件的样式和行为。
此枚举有一个 FlagsAttribute 特性,通过该特性可使其成员值按位组合。属性:
ContainerControl:如果为true,则控件是类似容器的控件。
UserPaint:如果为true,控件将自行绘制,而不是通过操作系统来绘制。如果为false,将不会引发 System.Windows.Forms.Control.Paint事件。此样式仅适用于派生自 System.Windows.Forms.Control的类。
Opaque:如果为true,则控件被绘制为不透明的,不绘制背景。
ResizeRedraw:如果为true,则在调整控件大小时重绘控件。
FixedWidth:如果为true,则自动缩放时,控件具有固定宽度。例如,如果布局操作尝试重新缩放控件以适应新的System.Drawing.Font,则控件的System.Windows.Forms.Control.Width 将保持不变。
FixedHeight: 如果为 true,则自动缩放时,控件具有固定高度。 例如,如果布局操作尝试重新缩放控件以适应新的 System.Drawing.Font,则控件的 System.Windows.Forms.Control.Height 将保持不变。
StandardClick:如果为true,则控件将实现标准 System.Windows.Forms .Control.Click 行为。
Selectable:如果为true,则控件可以接受焦点.
UserMouse:如果为true,则控件完成自己的鼠标处理,因而鼠标事件不由操作系统处理。
SupportsTransparentBackColor:如果为true,控件接受alpha 组件小于255的System.Windows.Forms.Control.BackColor 以模拟透明。仅在System.Windows.Forms.ControlStyles.UserPaint位置为true 并且父控件派生自 System.Windows.Forms.Control 时才模拟透明。
StandardDoubleClick:如果为true,则控件将实现标准 System.Windows.Forms.Control.DoubleClick行为。如果 System.Windows.Forms.ControlStyles.StandardClick 位未设置为true,则忽略此样式。
AllPaintingInWmPaint:如果为true,控件将忽略 WM_ERASEBKGND 窗口消息以减少闪烁。仅当System.Windows.Forms.ControlStyles.UserPaint 位 设置为true时,才应当应用该样式。
CacheText:如果为true,控件保留文本的副本,而不是在每次需要时从 System.Windows.Forms.Control.Handle 获取文本副本。次样式默认为false。此行为提高了性能,但使保持文本同步变得困难。
EnableNotifyMessage: 如果为 true,则为发送到控件的 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message@)的每条消息调用 System.Windows.Forms.Control.OnNotifyMessage(System.Windows.Forms.Message)方法。 此样式默认为 false。 System.Windows.Forms.ControlStyles.EnableNotifyMessage在部分可信的情况下不工作。
DoubleBuffer:如果为 true,则绘制在缓冲区中进行,完成后将结果输出到屏幕上。 双重缓冲区可防止由控件重绘引起的闪烁。 如果将 System.Windows.Forms.ControlStyles.DoubleBuffer设置为 true,则还应当将 System.Windows.Forms.ControlStyles.UserPaint 和 System.Windows.Forms.ControlStyles.AllPaintingInWmPaint 设置为 true。
OptimizedDoubleBuffer:如果为 true,则该控件首先在缓冲区中绘制,而不是直接绘制到屏幕上,这样可以减少闪烁。 如果将此属性设置为 true,则还应当将 System.Windows.Forms.ControlStyles.AllPaintingInWmPaint设置为 true。
UseTextForAccessibility:指定该控件的 Text 属性的值,如果已设置,则可确定该控件的默认 Active Accessibility 名称和快捷键。
例如,下面的一行 Visual Basic 代码将会启用双重缓冲。
myControl.SetStyle(UserPaint Or AllPaintingInWmPaint Or DoubleBuffer, True)
ToolBar 就采用这种方法。
true,这会产生同样的结果。
但这不是真正的透明。
|
|
|---|
|
如果在控件与其父控件之间还有另一个控件,则当前控件不会显示中间的控件。 |
Control.OnMouseWheel。
Control.DoubleClick 这两个主题。
Text属性。
对继承者的说明
true 会导致意外的行为,或者根本不会产生任何效果。