Hi,
Anyone could help me ?
I created a dialog using ResEdit/RC. I've managed to change the text and font of the created static controls in it, ie. labels, but I'm having difficulties
in changing the color of them.
I know that I have to use the API functions "SetBkColor" and "SetTextColor", but I do not know how to use them.
Anyone could point me in the right direction ?
Thanks !
Anyone could help me ?
I created a dialog using ResEdit/RC. I've managed to change the text and font of the created static controls in it, ie. labels, but I'm having difficulties
in changing the color of them.
I know that I have to use the API functions "SetBkColor" and "SetTextColor", but I do not know how to use them.
Code:
LOCAL hFont AS LONG ' Handle for font LOCAL hControl AS LONG ' Handle for control LOCAL hWnd AS LONG ' Handle for window LOCAL hDC AS DWORD ' Handle for device context LOCAL szText AS ASCIIZ * 50 . . . ' Changing font... Works fine ! hFont = PBFormsMakeFont("Courier", 9, %FW_EXTRABOLD, %FALSE, %FALSE, %FALSE, %DEFAULT_CHARSET) SendMessage hControl, %WM_SETFONT, hFont, 0& ' Changing caption... Works fine ! szText = "Test" SetWindowText(hControl, szText) ' What I'm trying... Didn't work completely right !... ' This is the code of my callback procedure SELECT CASE wMsg CASE %WM_CTLCOLORSTATIC SELECT CASE GetDlgCtrlId(lParam) CASE %IDC_VISOR5 SetBkColor wParam, %RED SetTextColor wParam, %WHITE SetBkMode wParam, %OPAQUE ' The objective is to change the background in the hole control to RED ! Now I'm getting only the text to the colors I needed. Not the hole background ! ' Don't know which object to use ! Tried BLACK_PEN, BLACK_BRUSH, DC_BRUSH, DC_PEN, neither one worked as I expected. FUNCTION = GetStockObject(%WHITE_PEN) EXIT FUNCTION END SELECT . . .
Thanks !
Comment