// Create a Bitmap on top of the Dialog. Use a little Bitmap ( Blanc )
// as container. The Dialog should be just a frame.
// The Bitmap ( Blanc 20 x 20 ) will be resized and filled with the
// defined Brush / Gradient / Color :
REDEFINE BITMAP oBmp1 ID 100 ADJUST RESOURCE "Blanc" OF oDlg
oBMP1:bPainted := { |hDC|OnPaint( hDC,oBMP1, 128,15779475, 77215, ;
"Horizontal Dialog Title", ;
oBfont1, 0 ,"TEST.BMP" ,3 ) }
//--------------- Paint the Dialog-Title --------------------------------//
FUNCTION ONPAINT(hDC,oBmp,nVColor, nBColor,nColor,cText, ;
oBFont1, nLEFT, cBRUSH, nPEN )
LOCAL hOldFont, oNewbrush, hBitmap, aRect, oBmp1, nTOP
hOldFont := SelectObject( hDC, oBFont1:hFont )
nTOP := 5
nTXTLG := GettextWidth( hDC, cText )
nBMPLONG := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
nFONTHIGHT := oBfont1:nInpHeight * -1
nLEFT := (nBMPLONG - nTXTLG) / 2
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
aRect := GETCLIENTRECT( oBmp:hWnd )
nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. ) // .T. Horizontal
oBmp:oBrush := TBrush():New( , nGRADIENT )
SetTextColor( hDC,nColor)
SetBkMode( oBmp:hDC, 0 )
FillRect( hDC, aRect, oBmp:oBrush:hBrush )
TextOut( hDC, nTOP, nLEFT, cText )
SelectObject( hDC, hOldFont )
IF nPEN > 0
DRAWBOX( aRect, hDC, nColor, nBMPLONG, nBMPHIGHT, nPEN )
ENDIF
RETURN NIL
// -------- DRAW BOX --------------------------------
STATIC FUNCTION DRAWBOX( aRect, hDC, nColor, nBMPLONG, nBMPHIGHT, nPEN )
LOCAL hPen := CREATEPEN( PS_SOLID, nPEN, nColor )
LOCAL hOldPen := SELECTOBJECT( hDC, hPen )
MOVETO( hDC, 0, 0 )
LINETO( hDC, nBMPLONG, 0 )
LINETO( hDC, nBMPLONG, nBMPHIGHT )
LINETO( hDC, 0, nBMPHIGHT )
LINETO( hDC, 0, 0 )
SELECTOBJECT( hDC, hOldPen )
DELETEOBJECT( hPen )
RETURN NIL
// Changing Title with GET
// ---------------------------------
REDEFINE GET oText1 VAR cText1 ID 120
oText1:bChange := {|| (nColor1 :=15779475, ;
nColor2 := 128, nColort := 0, ;
cText := "You changed the Get-Field : Customer", ;
lGrad := .F., nTop := 12, nLeft := 20, ;
nPen := 0, nPColor := 0, cBrush := "", ;
oBMP1:Refresh() ) }
// Could also be instead of a Text-Message a Database-Field :
// cText := (1)->PAT_NAME, ;
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 66 guests