Foreros:
Pues eso, necesito cambiar el color del texto a Check Box y Group Box.
Algún ejemplo?
Saludos
// Button< Reset > uses TESTCOLOR( oDlg, nBColor1, nTxtColor1 ) // RED = 255, WHITE = 16777215
// Button< Color > uses TESTCOLOR( oDlg, nBColor2, nTxtColor2 ) // BLUE = 16711680, YELLOW = 65535
#include "fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oBrush, oFont[3], oBtn[3], oGet[3], aX[3], c_Path, c_Path1
LOCAL nBColor1 := 255, nTxtColor1 := 16777215
LOCAL nBColor2 := 16711680, nTxtColor2 := 65535
LOCAL oSay1, cSay1 := "Test SAY-color", oRadio1, nRadio1 := 1, oCheck1, lCheck1 := .T.
c_path := cFilePath( GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "BITMAPS\"
aX[1] := 1
aX[2] := 2
aX[3] := 3
DEFINE FONT oFont[1] NAME "Tahoma" SIZE 0, - 12 BOLD
DEFINE FONT oFont[2] NAME "Tahoma" SIZE 0, - 14 BOLD
DEFINE FONT oFont[3] NAME "Tahoma" SIZE 0, - 16 BOLD
DEFINE BRUSH oBrush COLOR 16765090
DEFINE DIALOG oDlg SIZE 300, 220 ;
FONT oFont[1] TITLE "Set colors from class-name"
@ 10, 10 GET oGet[1] VAR aX[1] SIZE 10, 12 OF oDlg PICT "9" PIXEL RIGHT ;
FONT oFont[1] UPDATE
@ 28, 10 GET oGet[2] VAR aX[2] SIZE 12, 14 OF oDlg PICT "9" PIXEL RIGHT ;
FONT oFont[2] UPDATE
@ 48, 10 GET oGet[3] VAR aX[3] SIZE 14, 16 OF oDlg PICT "9" PIXEL RIGHT ;
FONT oFont[3] UPDATE
@ 70, 10 SAY oSay1 VAR cSay1 SIZE 80, 12 OF oDlg PIXEL FONT oFont[3] ;
UPDATE
@ 10, 40 RADIO oRadio1 VAR nRadio1 ITEMS "One", "Two", "Three" _3D ;
SIZE 40, 15 PIXEL UPDATE HELPID 100, 101, 102
oRadio1:SetFont( oFont[2] )
@ 10, 90 CHECKBOX oCheck1 VAR lCheck1 PROMPT "&Checkbox" SIZE 50, 12 OF oDlg PIXEL FONT oFont[3] UPDATE
@ 90, 10 BTNBMP oBtn[1] OF oDlg ;
SIZE 40, 15 PIXEL 2007 ;
NOBORDER ;
PROMPT "&Reset" ;
FILENAME c_path1 + "Reset.Bmp" ;
ACTION TESTCOLOR( oDlg, nBColor1, nTxtColor1 ) ;
FONT oFont[1] ;
LEFT
oBtn[1]:lTransparent := .T.
oBtn[1]:cToolTip = { "Set old color", "RESET", 1, CLR_BLACK, 14089979 }
oBtn[1]:SetColor( 0, )
@ 90, 55 BTNBMP oBtn[2] OF oDlg ;
SIZE 40, 15 PIXEL 2007 ;
NOBORDER ;
PROMPT "&Color" ;
FILENAME c_path1 + "Colors.Bmp" ;
ACTION TESTCOLOR( oDlg, nBColor2, nTxtColor2 ) ;
FONT oFont[1] ;
LEFT
oBtn[2]:lTransparent := .T.
oBtn[2]:cToolTip = { "Change color", "SET COLOR", 1, CLR_BLACK, 14089979 }
oBtn[2]:SetColor( 0, )
@ 90, 105 BTNBMP oBtn[3] OF oDlg ;
SIZE 40, 15 PIXEL 2007 ;
NOBORDER ;
PROMPT "&Exit" ;
FILENAME c_path1 + "Exit.Bmp" ;
ACTION oDlg:End() ;
FONT oFont[1] ;
LEFT
oBtn[3]:lCancel := .T.
oBtn[3]:lTransparent := .T.
oBtn[3]:cToolTip = { "Exit color-test", "EXIT", 1, CLR_BLACK, 14089979 }
oBtn[3]:SetColor( 0, )
TESTCOLOR( oDlg, nBColor1, nTxtColor1 )
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT oDlg:SetBrush( oBrush )
oFont[1]:End()
oFont[2]:End()
oFont[3]:End()
RELEASE BRUSH oBrush
RETURN NIL
// COLORES
FUNCTION TESTCOLOR( oDlg, nBColor, nTxtColor )
LOCAL Y, TXT, X := 1, cClassname, aItems := {}
// Get control-types and create array
// -----------------------------------------------
FOR X = 1 TO LEN( oDlg:aControls )
cClassname := oDlg:aControls[X]:Classname()
DEFAULT cClassname := "\\"
IF cClassname <> "\\"
// define Control-classes ( add needed controls )
// ----------------------------------------------------------------
IF cClassname = "TGET"
// Class-name ID Pos
AADD( aItems, { cClassname, oDlg:aControls[X]:nid, " ", X } )
ELSEIF cClassname = "TSAY"
// Class-name ID Pos
AADD( aItems, { cClassname, oDlg:aControls[X]:nid, " ", X } )
ELSEIF cClassname = "TRADIO"
// Class-name ID Pos
AADD( aItems, { cClassname, oDlg:aControls[X]:nid, " ", X } )
ELSEIF cClassname = "TCHECKBOX"
// Class-name ID Pos
AADD( aItems, { cClassname, oDlg:aControls[X]:nid, " ", X } )
ELSEIF cClassname = "TBTNBMP"
// Class-name ID Button-text Pos
AADD( aItems, { cClassname, oDlg:aControls[X]:nId, oDlg:aControls[X]:cCaption, X } )
ELSEIF cClassname = "TXBROWSE"
FOR Y = 1 TO LEN( oDlg:aControls[X]:aHeaders )
TXT := TXT + RTRIM( oDlg:aControls[X]:aHeaders[Y] ) + "|"
NEXT
// Class-name ID Col-text Pos
AADD( aItems, { cClassname, oDlg:aControls[X]:nId, TXT, X } )
ENDIF
ENDIF
IF aItems[X][1] = "TGET" .OR. aItems[X][1] = "TSAY"
//MsgAlert( nBCoColor, "Get and Say" )
oDlg:aControls[X]:Setcolor( nTxtColor, nBColor )
oDlg:aControls[X]:Refresh()
ENDIF
IF aItems[X][1] = "TRADIO"
//MsgAlert( nBColor, ' classname "TRADIO" ' )
oDlg:aControls[X]:SetColor( nTxtColor, nBColor )
oDlg:aControls[X]:Refresh()
ENDIF
IF aItems[X][1] = "TCHECKBOX"
// MsgAlert( nBColor, ' classname "TCHECKBOX" ' )
oDlg:aControls[X]:Setcolor( nTxtColor, nBColor )
oDlg:aControls[X]:Refresh()
ENDIF
NEXT
RETURN NIL
/*
oDlg:aControls[X]:oBrush:End()
oDlg:aControls[X]:SetColor( nTxtColor, nBColor )
*/
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot], russimicro, wilsongamboa and 37 guests