...ON PAINT gradientfill(oDlg:hDC,0,0,oDlg:nHeight(),oDlg:nWidth(),{{1,CLR_WHITE,CLR_RED}})
// ---------- PREVIEW -------------------------------------
FUNCTION NEW_SOURCE(oWnd1)
LOCAL oDlg5, oBtn50, oBtn51, oBtn52, oBtn53, oTITLE30
DEFINE DIALOG oDlg5 RESOURCE "Test" OF oWnd TITLE "Windows- / Dialog-Test and Source" FONT oProgFont
REDEFINE BUTTONBMP oBtn50 ID 50 OF oDlg5 ;
ACTION ( TEST_TRANS ( oDlg5 ) ) ;
BITMAP "Notes" PROMPT " Dialog-Test" TEXTRIGHT
oBtn50:cToolTip = { "Show" + CRLF + ;
"BMP-Transparent","BMP", 1, CLR_BLACK, 14089979 }
REDEFINE BUTTONBMP oBtn51 ID 40 OF oDlg5 ;
ACTION ( BITMAP_DAT ( oDlg5 ) ) ;
BITMAP "Notes" PROMPT " BMP-View" TEXTRIGHT
oBtn51:cToolTip = { "Show" + CRLF + ;
"Background-BMP","BMP", 1, CLR_BLACK, 14089979 }
REDEFINE BUTTONBMP oBtn52 ID 30 OF oDlg5 ;
ACTION ( SOURCE_DAT ( oDlg5 ) ) ;
BITMAP "Notes" PROMPT " Source" TEXTRIGHT
oBtn52:cToolTip = { "Show" + CRLF + ;
"Background-Source","Source", 1, CLR_BLACK, 14089979 }
REDEFINE BUTTONBMP oBtn53 ID 20 OF oDlg5 ;
ACTION ( oDlg5:End() ) ;
BITMAP "Quit" PROMPT " Exit" TEXTRIGHT
oBtn53:cToolTip = { "Close" + CRLF + ;
"the Dialog","Background-Test", 1, CLR_BLACK, 14089979 }
ACTIVATE DIALOG oDlg5 CENTERED ;
ON INIT NEW_COLOR3a(oDlg5) ;
ON PAINT( IIF( CLR_POS2 = 1, gradpaint2( hDC, oDlg5 ), NIL ), ;
IIF( BR_POS3 = 17, SHOW_PIC2( oDlg5 ), NIL ) )
oWnd1:End()
RETURN( NIL )
//------- BMP to Copy Gradient if needed ----------------------------//
FUNCTION BITMAP_DAT(oDlg5)
LOCAL oDlg6
DEFINE DIALOG oDlg6 RESOURCE "Bitmap" OF oDlg5 TITLE "BMP-Gradient" FONT oProgFont
ACTIVATE DIALOG oDlg6 CENTERED ;
ON PAINT gradpaint2( hDC, oDlg6 ) ;
RETURN( NIL )
// -----------------------------------
Function TEST_TRANS(oDlg5)
Local oDlg6, oBrush, oCbx, oRad, nVal := 1, lVal := .T.
DEFINE BRUSH oBrush FILE "Logo1.bmp"
DEFINE DIALOG oDlg6 RESOURCE "TestBMP" OF oDlg5 BRUSH oBrush TRANSPARENT ;
TITLE "Transparent-Dialog-Test ( Gradient or Brush )" FONT oProgFont
REDEFINE RADIO oRad VAR nVal ID 10 OF oDlg6
REDEFINE CHECKBOX oCbx VAR lVal ID 20 OF oDlg6
// selection
// -----------
// CLR_POS2 = 1 Gradient
// CLR_POS2 = 17 Brush
ACTIVATE DIALOG oDlg6 CENTERED ;
ON PAINT( IIF( CLR_POS2 = 1, gradpaint2( hDC, oDlg6 ), NIL ), ;
IIF( BR_POS3 = 17, SHOW_PIC2( oDlg6 ), NIL ) )
RETURN NIL
// -----------------------------------------------
static func gradpaint2( hDC, oDlg )
// Color-Vars
// ------------
local aGrad1 := { { nMOVE2, BR_COLOR3, BR_COLOR4 }, ;
{ nMOVE2, BR_COLOR4, BR_COLOR3 } }
// Style Hor. or Vert.
// ---------------------
IF BR_STYLE2 = 1
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad1, .T. )
ELSE
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad1, .F. )
ENDIF
RETURN NIL
// -----------------------------------
FUNCTION SHOW_PIC2( oDlg5 )
LOCAL oImage2
LOCAL aRect := GETCLIENTRECT( oDlg5:hWnd )
cNEWLOGO := ALLTRIM(cLOGO2)
IF BR_TYP2 = "B" // Brush-select
IF ! Empty( cNEWLOGO ) .and. File( "&cNEWLOGO" )
DEFINE BRUSH oImage2 FILE "&cNEWLOGO"
SET BRUSH OF oDlg5 TO oImage2
ELSE
MsgAlert("No file selected !","Attention" )
ENDIF
ENDIF
IF BR_TYP2 = "I" // Image-select
IF ! Empty( cNEWLOGO ) .and. File( "&cNEWLOGO" )
@ 0, 0 IMAGE oImage2 SIZE aRect[4], aRect[3] OF oDlg5 ADJUST
oImage2:LoadBmp( "&cNEWLOGO" )
ELSE
MsgAlert("No file selected !","Attention" )
ENDIF
ENDIF
RETURN( NIL )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 90 guests