event OwnerDrawEnd (Part as PartEnum, hDC as Long)
Ends painting the owner draw part.

 TypeDescription 
   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 )  
The OwnerDrawEnd event occurs after the default painting of the part is done, so it lets the user to paint additional pieces on the default part, if case . The OwnerDrawEnd event is fired only for owner draw parts. Use the OwnerDrawPart property to specify which part is owner draw and which part is not. Use the OwnerDrawStart event to perform painting part before default implementation is called. For instance, if the owner part paints a transparent or lucent skin, the OwnerDrawStart event lets you paint the part before putting the default skin. The rectangle that should be painted in the device context can be retrieved using the GetClipBox API function.  The VisiblePart or VisibleParts property specifies the part being visible or hidden.

Syntax for OwnerDrawEnd event, /NET version, on:

private void OwnerDrawEnd(object sender,exontrol.EXSLIDERLib.PartEnum Part,int hDC)
{
}

Private Sub OwnerDrawEnd(ByVal sender As System.Object,ByVal Part As exontrol.EXSLIDERLib.PartEnum,ByVal hDC As Integer) Handles OwnerDrawEnd
End Sub

Syntax for OwnerDrawEnd event, /COM version, on:

private void OwnerDrawEnd(object sender, AxEXSLIDERLib._ISliderEvents_OwnerDrawEndEvent e)
{
}

void OnOwnerDrawEnd(long Part,long hDC)
{
}

void __fastcall OwnerDrawEnd(TObject *Sender,Exsliderlib_tlb::PartEnum Part,long hDC)
{
}

procedure OwnerDrawEnd(ASender: TObject; Part : PartEnum;hDC : Integer);
begin
end;

procedure OwnerDrawEnd(sender: System.Object; e: AxEXSLIDERLib._ISliderEvents_OwnerDrawEndEvent);
begin
end;

begin event OwnerDrawEnd(long Part,long hDC)
end event OwnerDrawEnd

Private Sub OwnerDrawEnd(ByVal sender As System.Object, ByVal e As AxEXSLIDERLib._ISliderEvents_OwnerDrawEndEvent) Handles OwnerDrawEnd
End Sub

Private Sub OwnerDrawEnd(ByVal Part As EXSLIDERLibCtl.PartEnum,ByVal hDC As Long)
End Sub

Private Sub OwnerDrawEnd(ByVal Part As Long,ByVal hDC As Long)
End Sub

LPARAMETERS Part,hDC

PROCEDURE OnOwnerDrawEnd(oSlider,Part,hDC)
RETURN

Syntax for OwnerDrawEnd event, /COM version (others), on:

<SCRIPT EVENT="OwnerDrawEnd(Part,hDC)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function OwnerDrawEnd(Part,hDC)
End Function
</SCRIPT>

Procedure OnComOwnerDrawEnd OLEPartEnum llPart Integer llhDC
	Forward Send OnComOwnerDrawEnd llPart llhDC
End_Procedure

METHOD OCX_OwnerDrawEnd(Part,hDC) CLASS MainDialog
RETURN NIL

void onEvent_OwnerDrawEnd(int _Part,int _hDC)
{
}

function OwnerDrawEnd as v (Part as OLE::Exontrol.Slider.1::PartEnum,hDC as N)
end function

function nativeObject_OwnerDrawEnd(Part,hDC)
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;
		}
	}
}


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.