|
-
April 21st, 2008, 06:41 AM
#1
TextColor in Command Button
Can anyone tell me an easy way to set the text color of a button (forecolor) to any other color. Eg. red.
I followed a similar procedure as for that of an edit control.But it does not work. Here is the code.
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil)
{
HWND hwnd = CreateWindowEx ( //form options ); //Callback set to WindowProcedure
HWND hwnd2=CreateWindowEx(0,"BUTTON,""button1",WS_CHILD | WS_VISIBLE ,10,10,60,30,hwnd,NULL,hThisInstance,NULL);
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_CTLCOLORBTN: /*it is WM_CTLCOLOREDIT for an edit control. I am creating a button so i changed it to WM_CTLCOLORBTN*/
SetTextColor((HDC)wParam,RGB(254,0,0));
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|