Control style bit flag

xiaoxiao2021-03-06  23

The control style bit flag is used to classify supported behaviors. The control can enable styles by calling the setStyle method and incoming the appropriate controlStyles bit and setting the Boolean value of the bit. To determine the value assigned to the specified ControlStyles bit, use the GetStyle method and passed into the ControlStyles member you want to calculate.

WARNING Settings Control Style Bits fully change control behavior. Viewing the ControlStyles enumeration documentation can understand the impact of changing the control style bits before calling the SetStyle method.

Example

[Visual Basic, C #, C ] The following example enables dual buffering and update styles on the Form to reflect the modifications made.

[Visual Basic]

Public Sub EnabledoubleBuffering ()

'Set the value of the double-buffering style bits to true.

Me.SetStyle (ControlStyles.doublebuffer _

OR controlstyles.userpaint _

OR controlStyles.allpaintinginwmpaint, _

True)

Me.Updatestyles ()

End Sub

Related content can be referred to: ControlStyles enumeration

Remarks Control Use this enumeration in various properties and methods. The control can enable styles by calling the setStyle method and incoming the appropriate controlStyles bit and setting the Boolean value of the bit. For example, the following line Visual Basic code will enable double buffering. MyControl.setStyle (UserPaint OR AllPainningInwmpaint or Doublebuffer, true) If you set all the allPaintingINWMPAINT bit to true, the WM_ERASEBKGND window message is ignored directly from the WM_PAINT window message to the OnPaintBackground and the onPAINT method. This usually reduces flicker unless other controls send the WM_ERASEBKGND window message to the control. You can send a WM_ERASEBKGRND window message to achieve a false transparent effect similar to SupportstransparentBackColor; for example, this method is used in Toolbar with a flat appearance. To fully enable double buffering, set UserPaint, AllPaintingInWmpAint and DoubleBuffer bits to true. If the SupportstransParentbackColor bit is set to True, and BackColor is set to the alpha component less than 255 colors, ONPaintBackground will simulate transparency by requesting its parent control to draw backgrounds. But this is not a real transparent.

Note If there is another control between the control and its parent control, the current control does not display the middle control.

When the Usermouse bit is set to TRUE, the following methods are still called: Control.Onmousedown, Control.OnmouseEnter, Control.OnmouseEnter, Control.Onmousehover, Control.OnmouseEleel, Control.OnmouseElel. When you click on the control, if the StandardClick bit is set to True, the control.onclick method is called, which will trigger the Control.Click event. Double-click the control and StandardClick and StandardDoubleClick bits are set to TRUE, the click is passed to the DoubleClick event. Subsequently, the Control.ondoubleClick method is called, which will raise the Control.doubleClick event. However, regardless of the StandardClick and StandardDoubleClick bit, the control can directly call OnClick or OnDoubleClick. For more information on Control Click and Double-click Behavior, see Control.Click and Control.doubleClick these two topics. For the successor's instructions: If the control does not support Click or DoubleClick events, then inherit from the standard Windows Form Control and change the StandardClick or StandardDoubleClick bit value to TRUE, it will result in unexpected behavior, or no effect at all. member

转载请注明原文地址:https://www.9cbs.com/read-66217.html

New Post(0)