How make to GET stay transparent ?
i try oGet:lTRansparent:=.t.
no give me erro more no stay transparent
#include "fivewin.ch"
function main()
local odlg, oget, cVar:=space(50),ogetb, cVarb:=space(50)
define dialog odlg
@ 5, 10 get oGet var cVar of odlg pixel size 120, 10 noborder color CLR_WHITE
@ 20, 10 get oGetb var cVarb of odlg pixel size 120, 10 noborder color CLR_WHITE
oGet:lTransparent = .T.
oGetb:lTransparent = .T.
activate dialog odlg centered on init( GradGet( Self ) )
return nil
function GradGet( _oDlg )
local oControl
local aColors := { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
{ 0.6, nRGB( 24, 61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush
for n = 1 to Len(_oDlg:aControls)
oControl:= _oDlg:aControls[ n ]
if "TGET" $ oControl:ClassName()
hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
oBrush = TBrush():New( , , , , hBmp )
oControl:SetBrush( oBrush )
DeleteObject( hBmp )
endif
next
return Nil
function GradientBmp( oWnd, nWidth, nHeight, aColors )
local hDC, hBmp, hBmpOld
local aRect := GetClientRect( oWnd:hWnd )
default nHeight := aRect[ 3 ] , nWidth := aRect[ 4 ]
hDC = CreateCompatibleDC( oWnd:GetDC() )
hBmp = CreateCompatibleBitMap( oWnd:hDC, nWidth, nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, nHeight, nWidth, aColors )
SelectObject( hDC, hBmpOld )
DeleteDC( hDC )
DeleteObject( hBmpOld )
oWnd:ReleaseDC()
return hBmp
FUNCTION T_PREVIEW4()
LOCAL oDlg5, oBtn50, oBtn30, oGet, oBMP0
LOCAL oGET1,oGET2,oGET3,oGET4,oGET5,oGET6
LOCAL oGET7,oGET8,oGET9,oGET10,oGET11,oGET12
oProgFont := TFont():New("Arial", ,-16,.F.,.F. , , , ,.F. )
DEFINE DIALOG oDlg5 RESOURCE "TXTTEST3" TITLE "Text-Test" ;
FONT oProgFont // TRANSPARENT
REDEFINE BITMAP oBMP0 ID 300 ADJUST RESOURCE "White" OF oDlg5
oBMP0:cTooltip := "Please select a Button"
// Windows- Dialog-Title Height = 30
// --------------------------------------------
oBMP0:bPainted := { |hDC| ;
DRAW_TITLE( oDlg5, ;
oBMP0, ; // BMP
hDC, ; // hDC
.T., ; // Horiz. or Vert.
14853684, ; // 1. Grad-Color
16314573, ; // 2. Grad-Color
0.50, ; // Color-Pos.
30, ; // Text-Pos from left ( 0 = centered )
oButtFont, ; // Font
128, ; // Font-Color
"GET with Gradient on Dialog-Gradient or Color ...") }
REDEFINE SAY oGET1 VAR cText1 ID 110 OF oDlg5 COLOR T_COLOR NOBORDER FONT oTextFont
oGet1:lTransparent = .T.
// 12 GET's
REDEFINE BTNBMP oBtn30 ID 30 OF oDlg5 2007 ;
FILENAME c_path + "\Images\Preview.bmp" ;
LEFT ;
PROMPT " &Source " ;
FONT oProgFont ;
ACTION ( SET_TEXT() )
oBtn30:lTransparent = .t.
oBtn30:cTooltip := { "Show" + CRLF + ;
"the Source","Source", 1, CLR_BLACK, 14089979 }
REDEFINE BTNBMP oBtn50 ID 50 OF oDlg5 2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT " &Exit " ;
FONT oProgFont ;
ACTION ( oDlg5:End() )
oBtn50:lTransparent = .t.
oBtn50:cTooltip := { "Close" + CRLF + ;
"the Gradient-Test","Close Dialog", 1, CLR_BLACK, 14089979 }
ACTIVATE DIALOG oDlg5 CENTERED ;
ON INIT ( D_GRAD( oDlg5, hDC ), GradGet( Self ) )
return nil
oProgFont:End()
RETURN( NIL )
// -------------------------------
FUNCTION GradGet( _oDlg )
local oControl
local aColors := { { T_MOVE, T_COLOR1, T_COLOR2 },;
{ 1-T_MOVE, T_COLOR2, T_COLOR1 } }
local hBmp, n
local oBrush
for n = 1 to Len(oDlg:aControls)
oControl:= oDlg:aControls[ n ]
* if "TGET" $ oControl:ClassName() // NOT DETECTED
hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
oBrush = TBrush():New( , , , , hBmp )
oControl:SetBrush( oBrush )
DeleteObject( hBmp )
* endif
next
RETURN NIL
// test
#INCLUDE "FIVEWIN.CH"
FUNCTION MAIN()
//
//
LOCAL ODLG, ;
DNOM := SPACE(40), ;
DSURNOM := SPACE(40), ;
DTEL := SPACE(10), ;
DPOSTAL := SPACE(05), ;
DREFCDE := SPACE(40), ;
LSAVE := .F. , ;
DVILLE := SPACE(30),aFont
//
SetResDebug( .t. )
DEFINE FONT aFONT NAME "Times New Roman" SIZE 0,-14 BOLD
//
DEFINE DIALOG ODLG RESOURCE "DEV02"
//
REDEFINE GET DNOM ID 201 OF ODLG PICTURE REPLICATE("X",40)
REDEFINE GET DSURNOM ID 202 OF ODLG PICTURE REPLICATE("X",40)
REDEFINE GET DVILLE ID 203 OF ODLG PICTURE REPLICATE("!",30)
REDEFINE GET DREFCDE ID 204 OF ODLG
REDEFINE GET DTEL ID 205 OF ODLG PICTURE "@R XX-XX-XX-XX-XX"
REDEFINE GET DPOSTAL ID 206 OF ODLG PICTURE "@Z 99999"
//
REDEFINE BTNBMP RESOURCE "BUTCAN" ID 02 OF ODLG ;
ACTION(LSAVE := .F., ODLG:END() )
//
REDEFINE BTNBMP RESOURCE "BUTOK" ID 01 OF ODLG ;
ACTION LSAVE := .T., ODLG:END()
//
ACTIVATE DIALOG ODLG CENTERED on init( GradGet( Self ) )
AFONT:END()
CheckRes()
RETURN NIL
function GradGet( _oDlg )
local oControl
local aColors := { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
{ 0.6, nRGB( 24, 61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush
for n = 1 to Len(_oDlg:aControls)
oControl:= _oDlg:aControls[ n ]
if oControl:ClassName() == "TGET"
oControl:lTransparent = .T.
hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
oBrush = TBrush():New( , , , , hBmp )
oControl:SetBrush( oBrush )
DeleteObject( hBmp )
endif
next
return Nil
* Enhancements: Class TBrush
a. Now any image file ( jpg, png, etc. ) can be used to create a Brush.
b. Brush can also be created from a bitmap handle by specifying the handle as the fifth parameter of TBrush():New() method. Command support for this is not provided.
function GradGet( _oDlg )
local oControl
local aColors := { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
{ 0.6, nRGB( 24, 61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush
for n = 1 to Len(_oDlg:aControls)
oControl:= _oDlg:aControls[ n ]
if oControl:ClassName() == "TGET"
oControl:lTransparent = .T.
hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
oBrush = TBrush():New( ) //<==
oBrush:hBrush = CreatePatternBrush( hBmp ) //<==
oControl:SetBrush( oBrush )
DeleteObject( hBmp )
endif
next
return Nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 100 guests