Click here to Skip to main content
15,891,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DEstroyWindow and Focus question ( weird behaviour) Pin
Maximilien8-Mar-05 4:00
Maximilien8-Mar-05 4:00 
GeneralRe: DEstroyWindow and Focus question ( weird behaviour) Pin
Ryan Binns8-Mar-05 12:23
Ryan Binns8-Mar-05 12:23 
GeneralNot a C++ coder needing C++ help Pin
LongRange.Shooter7-Mar-05 4:21
LongRange.Shooter7-Mar-05 4:21 
GeneralRe: Not a C++ coder needing C++ help Pin
Serge Krynine7-Mar-05 14:17
Serge Krynine7-Mar-05 14:17 
GeneralRe: Not a C++ coder needing C++ help Pin
LongRange.Shooter8-Mar-05 2:11
LongRange.Shooter8-Mar-05 2:11 
GeneralRe: Not a C++ coder needing C++ help Pin
Serge Krynine8-Mar-05 13:58
Serge Krynine8-Mar-05 13:58 
GeneralSubstitute CFTPConnection Pin
densitet7-Mar-05 3:59
densitet7-Mar-05 3:59 
GeneralButton Background color and Text Pin
sweep1237-Mar-05 3:46
sweep1237-Mar-05 3:46 
I have included code to try and draw a button with a different background when the button has been activated (pressed once).

I have a bool which tracks the state of the button.

HBRUSH CEmuGUI::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{

        HBRUSH hbr = NULL;
	// Font for the current waypoint marker
	CFont LabelFont;

	if(nCtlColor == CTLCOLOR_BTN)
	{
		if((pWnd->GetDlgCtrlID() == IDC_1ST_BUTTON) && (g_bFirstButton))
		{
			// Set up the Font for the Button
			LabelFont.CreateFont 
                           (10,10,0,0,FW_BOLD, FALSE, FALSE, 0,  
                            DEFAULT_CHARSET,OUT_CHARACTER_PRECIS, 
                            CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY,
			    DEFAULT_PITCH, NULL);
			pWnd->SetFont (&LabelFont, TRUE);
			pDC->SetBkColor(LTGRAY_BRUSH);
			pDC->SetTextColor(RGB(255,255,0));
			return (HBRUSH)GetStockObject(LTGRAY_BRUSH);
		}
	}
	
    return hbr;
}


I am getting in a bit of a mess.

What I would like is when the button is pressed, background color is green and button text is bold and when pressed again revert back to normals colors.

Any suggestions.
GeneralStrikethrough text in CListCtrl Pin
DanYELL7-Mar-05 3:16
DanYELL7-Mar-05 3:16 
GeneralRe: Strikethrough text in CListCtrl Pin
Manfred Staiger7-Mar-05 3:37
Manfred Staiger7-Mar-05 3:37 
QuestionHow to check if logged on user has admin privileges Pin
g3e7-Mar-05 3:01
g3e7-Mar-05 3:01 
AnswerRe: How to check if logged on user has admin privileges Pin
Sheng Jiang 蒋晟7-Mar-05 15:00
Sheng Jiang 蒋晟7-Mar-05 15:00 
GeneralMemory Visualization Pin
Naqeeb Ullah Jan7-Mar-05 2:22
Naqeeb Ullah Jan7-Mar-05 2:22 
GeneralRe: Memory Visualization Pin
Serge Krynine7-Mar-05 12:36
Serge Krynine7-Mar-05 12:36 
GeneralTansparent Rectangle Pin
nripun7-Mar-05 1:35
nripun7-Mar-05 1:35 
GeneralRe: Tansparent Rectangle Pin
Roger Allen7-Mar-05 1:48
Roger Allen7-Mar-05 1:48 
GeneralRe: Tansparent Rectangle Pin
nripun7-Mar-05 2:10
nripun7-Mar-05 2:10 
GeneralRe: Tansparent Rectangle Pin
basementman7-Mar-05 7:48
basementman7-Mar-05 7:48 
GeneralTranslation applications in other language Pin
cosmyn117-Mar-05 1:04
cosmyn117-Mar-05 1:04 
GeneralDirectShow Pin
Anonymous7-Mar-05 0:55
Anonymous7-Mar-05 0:55 
GeneralVideo For Windows - CODECS Pin
Jay Carter7-Mar-05 0:40
Jay Carter7-Mar-05 0:40 
Generaltext flicker using bitblt Pin
ThinkingPrometheus6-Mar-05 23:55
ThinkingPrometheus6-Mar-05 23:55 
Generalchanging FormView at Runtime Pin
drai6-Mar-05 22:56
drai6-Mar-05 22:56 
GeneralRe: changing FormView at Runtime Pin
Michael P Butler6-Mar-05 23:16
Michael P Butler6-Mar-05 23:16 
GeneralRe: changing FormView at Runtime Pin
drai7-Mar-05 12:40
drai7-Mar-05 12:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.