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

if i modified data in 1 view how does the other view knows

2 Answers   Siemens,


how can u change button shape at run time

3 Answers   Samsung,


How you find memory leaks?

4 Answers   ABB,


Name the Synchronization objects?

2 Answers  


If there is more than 100 control in a window how we can change the Taborder of a controls

4 Answers   Satyam,






Does the application have more than one object? If Yes, Briefly explain.

2 Answers   Soltius Infotech,


Does the application have more than one object? If no, then what is the reason?

5 Answers  


Given two processes, how can they share memory?

2 Answers   Microsoft,


What?s the difference between Modal and Modeless Dialog?

12 Answers   Jekson, Usl India,


What is CSingleDocTemplate?

1 Answers  


What is the difference between hinsrtance and hprevinstance in WinMain function?

3 Answers  


1.Get string1,string2,string3 1.add string1 and 2,string1 and 3. 2.replace vowels with T 3.count number of T. 4.remove T 5.COPY string1 to stringf. 6.restore string1. print the following 1.Number of T 2.StringF 3.string1+string2+string3 Use pointers and functions

1 Answers  


Categories