Type | Description | |||
Part as PartEnum | A PartEnum expression that indicates the part being painted | |||
hDC as Long | A long expression that indicates the handle to the painting device context ( HDC ) | |||
DefaultPainting as Boolean | (By Reference) A Boolen expression that indicates whether the default painting should be performed or not. If the DefaultPainting parameter is True, the control paints the part as default, else the part is not painted by the control so the user should draw the entire part. |
private void OwnerDrawStart(object sender,exontrol.EXSLIDERLib.PartEnum Part,int hDC,ref bool DefaultPainting) { } Private Sub OwnerDrawStart(ByVal sender As System.Object,ByVal Part As exontrol.EXSLIDERLib.PartEnum,ByVal hDC As Integer,ByRef DefaultPainting As Boolean) Handles OwnerDrawStart End Sub |
private void OwnerDrawStart(object sender, AxEXSLIDERLib._ISliderEvents_OwnerDrawStartEvent e) { } void OnOwnerDrawStart(long Part,long hDC,BOOL FAR* DefaultPainting) { } void __fastcall OwnerDrawStart(TObject *Sender,Exsliderlib_tlb::PartEnum Part,long hDC,VARIANT_BOOL * DefaultPainting) { } procedure OwnerDrawStart(ASender: TObject; Part : PartEnum;hDC : Integer;var DefaultPainting : WordBool); begin end; procedure OwnerDrawStart(sender: System.Object; e: AxEXSLIDERLib._ISliderEvents_OwnerDrawStartEvent); begin end; begin event OwnerDrawStart(long Part,long hDC,boolean DefaultPainting) end event OwnerDrawStart Private Sub OwnerDrawStart(ByVal sender As System.Object, ByVal e As AxEXSLIDERLib._ISliderEvents_OwnerDrawStartEvent) Handles OwnerDrawStart End Sub Private Sub OwnerDrawStart(ByVal Part As EXSLIDERLibCtl.PartEnum,ByVal hDC As Long,DefaultPainting As Boolean) End Sub Private Sub OwnerDrawStart(ByVal Part As Long,ByVal hDC As Long,DefaultPainting As Boolean) End Sub LPARAMETERS Part,hDC,DefaultPainting PROCEDURE OnOwnerDrawStart(oSlider,Part,hDC,DefaultPainting) RETURN |
<SCRIPT EVENT="OwnerDrawStart(Part,hDC,DefaultPainting)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function OwnerDrawStart(Part,hDC,DefaultPainting) End Function </SCRIPT> Procedure OnComOwnerDrawStart OLEPartEnum llPart Integer llhDC Boolean llDefaultPainting Forward Send OnComOwnerDrawStart llPart llhDC llDefaultPainting End_Procedure METHOD OCX_OwnerDrawStart(Part,hDC,DefaultPainting) CLASS MainDialog RETURN NIL void onEvent_OwnerDrawStart(int _Part,int _hDC,COMVariant /*bool*/ _DefaultPainting) { } function OwnerDrawStart as v (Part as OLE::Exontrol.Slider.1::PartEnum,hDC as N,DefaultPainting as L) end function function nativeObject_OwnerDrawStart(Part,hDC,DefaultPainting) return |
For instance, the following VB sample draws the lower part in red, and the upper part in green ( as in the screen shot ) :
With Slider1 .OwnerDrawPart(exLowerBackPart Or exUpperBackPart) = True End With
Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Declare Function GetClipBox Lib "gdi32" (ByVal hdc As Long, lpRect As RECT) As Long Private Declare Function FillRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Sub Slider1_OwnerDrawEnd(ByVal Part As EXSLIDERLibCtl.PartEnum, ByVal hdc As Long) Dim r As RECT, h As Long GetClipBox hdc, r r.Left = r.Left + 4 r.Right = r.Right - 4 If Part = exLowerBackPart Then h = CreateSolidBrush(RGB(255, 0, 0)) FillRect hdc, r, h DeleteObject (h) Else If Part = exUpperBackPart Then h = CreateSolidBrush(RGB(0, 255, 0)) FillRect hdc, r, h DeleteObject (h) End If End If End Sub
The following C++ sample draws the lower part in red, and the upper part in green ( as in the screen shot ) :
m_slider.SetOwnerDrawPart( 128 /*exUpperBackPart*/, TRUE ); m_slider.SetOwnerDrawPart( 512 /*exLowerBackPart*/, TRUE );
void OnOwnerDrawEndSlider1(long Part, long hDC) { HDC h = (HDC)hDC; RECT rtPart = {0}; GetClipBox( h, &rtPart ); InflateRect( &rtPart, -4, 0 ); switch ( Part ) { case 128: /*exUpperBackPart*/ { HBRUSH hB = CreateSolidBrush( RGB(0,255,0) ); FillRect( h, &rtPart, hB ); DeleteObject( hB ); break; } case 512: /*exLowerBackPart*/ { HBRUSH hB = CreateSolidBrush( RGB(255,0,0) ); FillRect( h, &rtPart, hB ); DeleteObject( hB ); break; } } }