METHOD Paint() CLASS TGet
local aInfo := ::DispBegin()
local hOldFont
local nClrBtnTxt, nClrBtnPane
local nOldMode
nClrBtnTxt := ::nClrText
nClrBtnPane := ::nClrPane
if ::oBrush != nil
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
else
CallWindowProc( ::nOldProc, ::hWnd, WM_ERASEBKGND, ::hDC, 0 )
endif
if IsWindowEnabled( ::hWnd )
CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
else
if ::lDisColors
SetTextColor( ::hDC, GetSysColor( COLOR_GRAYTEXT ) )
SetBkColor( ::hDC, GetSysColor( COLOR_WINDOW ) )
nClrBtnPane := GetSysColor( COLOR_WINDOW )
else
if ValType( ::nClrTextDis ) == "B"
SetTextColor( ::hDC, Eval( ::nClrTextDis ) )
elseif ValType( ::nClrTextDis ) == "N"
if ::nClrTextDis >= 0
SetTextColor( ::hDC, ::nClrTextDis )
nClrBtnTxt := ::nClrTextDis
else
SetTextColor( ::hDC, ::nClrText )
endif
endif
if ValType( ::nClrPaneDis ) == "B"
SetBkColor( ::hDC, Eval( ::nClrPaneDis ) )
elseif ValType( ::nClrPaneDis ) == "N"
if ::nClrPaneDis >= 0
SetBkColor( ::hDC, ::nClrPaneDis )
nClrBtnPane := ::nClrPaneDis
else
SetBkColor( ::hDC, ::nClrPane )
endif
endif
endif
if ::oFont != nil
hOldFont = SelectObject( ::hDC, ::oFont:hFont )
endif
nOldMode = SetBkMode( ::hDC, TRANSPARENT )
do case
case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER )
SetTextAlign( ::hDC, TA_CENTER )
if ::lSpinner
ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 - GetSysMetrics( SM_CYHSCROLL ) ) / 2,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
else
ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 ) / 2,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
endif
case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT )
SetTextAlign( ::hDC, TA_RIGHT )
if ::lSpinner
ExtTextOut( ::hDC, 1, ::nWidth() - 7 - GetSysMetrics( SM_CYHSCROLL ),;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
else
if ValType( ::bAction ) == "B"
ExtTextOut( ::hDC, 1, ::nWidth() - 7 - ::nHeight,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
else
ExtTextOut( ::hDC, 1, ::nWidth() - 7 ,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
endif
endif
otherwise
SetTextAlign( ::hDC, TA_LEFT )
ExtTextOut( ::hDC, 1, 2,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
endcase
if ::oFont != nil
SelectObject( ::hDC, hOldFont )
endif
SetBkMode( ::hDC, nOldMode )
endif
if ValType( ::bPainted ) == "B"
Eval( ::bPainted, ::hDC, ::cPS, Self )
endif
// button
if ::oBtn != nil .and. ::lBtnTransparent
::oBtn:SetColor( nClrBtnTxt, nClrBtnPane )
endif
::DispEnd( aInfo )
return 1