how to give colour for dialog button or static buuto?any
one explain full code ?pls pls

Answers were Sorted based on User's Feedback



how to give colour for dialog button or static buuto?any one explain full code ?pls pls..

Answer / abhishek kesharwani

Brush *brush;
Initialize the brush pointer in the constructor of your Dialog
Code:
brush = new CBrush(RGB(49,49,49));
Add the WM_CTLCOLR Message handler for the dialog and add the following code
Code:
switch (nCtlColor) {

case CTLCOLOR_BTN:
pDC->SetTextColor(RGB(0, 255, 0));
pDC->SetBkColor(RGB(0, 0, 0));
return (HBRUSH)(brush->GetSafeHandle());
default:
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}

Is This Answer Correct ?    2 Yes 1 No

how to give colour for dialog button or static buuto?any one explain full code ?pls pls..

Answer / harinish

use wm_drawitem function to color the button or static box

Is This Answer Correct ?    1 Yes 5 No

how to give colour for dialog button or static buuto?any one explain full code ?pls pls..

Answer / pranesh archak

Subclass the control (button or static control) and use
message refelction for message handling.

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More MFC Interview Questions

What are the differences between MFC Exception macros and C++ exception keywords?

2 Answers  


What is difference between the TCP/IP and UDP socket

5 Answers   Invensys,


What is the initial function to be called in MFC and what it will do

11 Answers   Infosys,


What is the difference between Struts and JSF? Pls list some most suitable differences.

0 Answers  


Why Array Index starts from Zero

30 Answers   HCL,






What does mfc stand for?

0 Answers  


How do I create a dialog box in mfc?

0 Answers  


Hi All, I have created one MFC Dialog Based application.now if i am running the application its working fine,instead of closing he application i minimized the application,if i run the application again,i am getting the Dialog. I want to prevent the calling of application multiple times. please give me the code and let me know in which method i need to make changes. Praveer

7 Answers   HP,


What is the use of message map ?

5 Answers   TCS,


What is the difference between the Encapsulation and Abstraction

25 Answers   HCL, Invensys, TCS, Wipro,


how to repaint when working with horizontal scroll bar

0 Answers  


What is subclassing?

2 Answers  


Categories