I have some btnbmp with pngs
when are disabled I see a bad btnbmp
but I think is for png file
I have some btnbmp with pngs
when are disabled I see a bad btnbmp
but I think is for png file
@ 525, 570 BTNBMP oBtn[7] OF oDlg2 ;
SIZE 100, 45 PIXEL 2007 ; // B / H
PROMPT " &Exit " ;
ACTION oDlg2:End() ;
FONT oFont ;
LEFT
oBtn[7]:LoadBitmaps( , , c_path1 + "Exit.png" )
oBtn[7]:SetImages(c_path1 + "Exit.png")
SetTextColor( oBtn[7]:hDC, 0 )
oBtn[7]:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { 0.5, 10526975, 16777215 }, ;
{ 0.5, 16777215, 10526975 } }, ;
{ { 0.5, 16768185 , 10526975 }, ;
{ 0.5, 10526975, 16768185 } } ) }
oBtn[7]:cToolTip = { "Exit BORDER-tests","EXIT", 1, CLR_BLACK, 14089979 }
oBtn[7]:SetColor( 0, )
@ 525, 680 BTNBMP oBtn[8] OF oDlg2 ;
SIZE 100, 45 PIXEL 2007 ; // B / H
PROMPT " &Exit " ;
ACTION oDlg2:End() ;
FONT oFont ;
LEFT
oBtn[8]:Disable() // !!!
oBtn[8]:LoadBitmaps( , , c_path1 + "Exit.png" )
oBtn[8]:SetImages(c_path1 + "Exit.png")
SetTextColor( oBtn[8]:hDC, 0 )
oBtn[8]:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { 0.5, 10526975, 16777215 }, ;
{ 0.5, 16777215, 10526975 } }, ;
{ { 0.5, 16768185 , 10526975 }, ;
{ 0.5, 10526975, 16768185 } } ) }
oBtn[8]:cToolTip = { "Exit BORDER-tests","EXIT", 1, CLR_BLACK, 14089979 }
oBtn[8]:SetColor( 0, )
Silvio.Falconi wrote:I have some btnbmp with pngs
when are disabled I see a bad btnbmp
but I think is for png file
#define DLG_nColorBtn1 RGB( 245,245,235)
#define DLG_nColorBtn2 RGB(250,250,245)
#define DLG_nColorBtnB RGB(195,195,185)
Function sample()
local oDlg,oBtn,oFont
local nHt := Int( ScreenHeight() * 0.2 )
local nWd := Int( ScreenWidth() * 0.2 )
local lNormal :=.f.
local nClrBorder := RGB(243,243,238)
local oChk
local oGet,cGet:= space(100)
local oSay[1]
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
RESIZABLE TiTle "test" COLOR CLR_BLACK, RGB( 245,245,235) ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX, WS_THICKFRAME )
@ 10,10 CheckBox oChk Var lNormal Prompt "check" SIZE 100,20 of oDlg ;
on change ( If(lNormal,(oBtn:Enable(), oGet:enable()),;
(oBtn:Disable(), oGet:disable())),;
oBtn:refresh(), oGet:refresh() )
@ 10, 10 BTNBMP oBtn ;
FILENAME "test.png" ;
FLAT SIZE 50,50 OF oDlg PIXEL ;
NOROUND action msginfo()
oBtn:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 0.25, DLG_nColorBtn1, DLG_nColorBtn2 },;
{ 0.75, DLG_nColorBtn2, DLG_nColorBtn1 } },;
{ { 0.25, DLG_nColorBtn2, DLG_nColorBtn1 }, ;
{ 0.75, DLG_nColorBtn1, DLG_nColorBtn2 } } ) }
oBtn:nClrBorder := DLG_nColorBtnB
@ 62, 10 SAY oSay[1] PROMPT "Test Get" SIZE 100,25 PIXEL OF oDlg TRANSPARENT FONT oFont
@ 80, 10 GET oGet VAR cGet SIZE 100,24 PIXEL OF oDlg
ACTIVATE DIALOG oDlg CENTERED
return nil
METHOD Disable() INLINE ::Super:Disable(), ::Refresh()
METHOD Disable() INLINE ::lActive := .f.,;
If( ::hWnd != 0, EnableWindow( ::hWnd, .f. ),)
/*
METHOD Disable() INLINE ; It paints on the desktop cause hDC is not ready!
Also users may not want to see their bitmaps in gray!
DrawGray( ::GetDC(), ::hBitmap ), ::ReleaseDC(), ::Super:Disable() */
HB_FUNC( DRAWGRAY ) // ( hDC, hBitmap, nRow, nCol, nWidth, nHeight ) --> nil
{
DrawGray( ( HDC ) fw_parH( 1 ), ( HBITMAP ) fw_parH( 2 ),
hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ) );
}
Function MakeDisable_BtnBmp(oBtn)
local aBru[ 2 ]
DEFINE BRUSH aBru[ 1 ] STYLE BDIAGONAL COLOR Rgb(195,195,185) // you can use also FDIAGONAL or another type type BORLAND OLD
DEFINE BRUSH aBru[ 2 ] STYLE BDIAGONAL COLOR Rgb(195,195,185)
oBtn:l2007:=.t.
oBtn:SetFile(,)
oBtn:lBorder := .f.
oBtn:bClrGrad := { |lInvert| If( lInvert, aBru[ 2 ]:hBrush, aBru[ 1 ]:hBrush ) }
oBtn:disable()
RETURN NIL
Silvio.Falconi wrote:
- Code: Select all Expand view
#define DLG_nColorBtn1 RGB( 245,245,235)
#define DLG_nColorBtn2 RGB(250,250,245)
#define DLG_nColorBtnB RGB(195,195,185)
Function sample()
local oDlg,oBtn,oFont
local nHt := Int( ScreenHeight() * 0.2 )
local nWd := Int( ScreenWidth() * 0.2 )
local lNormal :=.f.
local nClrBorder := RGB(243,243,238)
local oChk
local oGet,cGet:= space(100)
local oSay[1]
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
RESIZABLE TiTle "test" COLOR CLR_BLACK, RGB( 245,245,235) ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX, WS_THICKFRAME )
@ 10,10 CheckBox oChk Var lNormal Prompt "check" SIZE 100,20 of oDlg ;
on change ( If(lNormal,(oBtn:Enable(), oGet:enable()),;
(oBtn:Disable(), oGet:disable())),;
oBtn:refresh(), oGet:refresh() )
@ 10, 10 BTNBMP oBtn ;
FILENAME "test.png" ;
FLAT SIZE 50,50 OF oDlg PIXEL ;
NOROUND action msginfo()
oBtn:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 0.25, DLG_nColorBtn1, DLG_nColorBtn2 },;
{ 0.75, DLG_nColorBtn2, DLG_nColorBtn1 } },;
{ { 0.25, DLG_nColorBtn2, DLG_nColorBtn1 }, ;
{ 0.75, DLG_nColorBtn1, DLG_nColorBtn2 } } ) }
oBtn:nClrBorder := DLG_nColorBtnB
@ 62, 10 SAY oSay[1] PROMPT "Test Get" SIZE 100,25 PIXEL OF oDlg TRANSPARENT FONT oFont
@ 80, 10 GET oGet VAR cGet SIZE 100,24 PIXEL OF oDlg
ACTIVATE DIALOG oDlg CENTERED
return nil
@ 10, 10 BTNBMP oBtn ;
FILENAME "test.png" ;
FLAT SIZE 50,50 OF oDlg PIXEL GDIP ;
NOROUND action msginfo()
function testbtnpaint()
local oDlg, aBtn, n
local cPngPath := "..\bitmaps\pngs\"
local aPng := { cPngPath + "2.png" }
AEval( FW_ListAsArray( "1,2,6,7,8,9,10" ), { |c| ;
AAdd( aPng, cPngPath + "image" + c + ".png" ) } )
aBtn := ARRAY( 3, Len( aPng ) )
DEFINE DIALOG oDlg SIZE 80 + 70 * Len( aPng ), 430 PIXEL TRUEPIXEL ;
TITLE "BTNBMP: WITH AND WITHOUT GDIP CLAUSE"
@ 40, 40 SAY "ENABLED BUTTONS NORMAL LOOK" SIZE 400,12 PIXEL OF oDlg
for n := 1 to Len( aPng )
@ 70, n * 70 - 30 BTNBMP aBtn[ 1, n ] FILE aPng[ n ] SIZE 64,64 PIXEL GDIP OF oDlg
next
@ 150, 40 SAY "DISABLED BUTTONS WITH GDIP clause" SIZE 400,12 PIXEL OF oDlg
for n := 1 to Len( aPng )
@ 180, n * 70 - 30 BTNBMP aBtn[ 1, n ] FILE aPng[ n ] SIZE 64,64 PIXEL GDIP OF oDlg WHEN .F.
next
@ 260, 40 SAY "DISABLED BUTTONS WITHOUT GDIP clause" SIZE 400,12 PIXEL OF oDlg
for n := 1 to Len( aPng )
@ 290, n * 70 - 30 BTNBMP aBtn[ 1, n ] FILE aPng[ n ] SIZE 64,64 PIXEL /*GDIP*/ OF oDlg WHEN .F.
next
ACTIVATE DIALOG oDlg CENTERED
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 89 guests