Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Silent Code Signing? Pin
Peter Weyzen2-Mar-06 21:52
Peter Weyzen2-Mar-06 21:52 
GeneralRe: Silent Code Signing? Pin
DoctorEd5-Mar-06 9:46
DoctorEd5-Mar-06 9:46 
QuestionFail to set profile on Windows Media Video Image Pin
Kin Tutnik2-Mar-06 19:33
Kin Tutnik2-Mar-06 19:33 
QuestionColor to Static Control (Urgent pls) Pin
RockyJames2-Mar-06 19:30
RockyJames2-Mar-06 19:30 
AnswerRe: Color to Static Control (Urgent pls) Pin
Ryan Binns2-Mar-06 19:33
Ryan Binns2-Mar-06 19:33 
GeneralRe: Color to Static Control (Urgent pls) Pin
RockyJames2-Mar-06 19:38
RockyJames2-Mar-06 19:38 
GeneralRe: Color to Static Control (Urgent pls) Pin
Naveen2-Mar-06 19:48
Naveen2-Mar-06 19:48 
GeneralRe: Color to Static Control (Urgent pls) Pin
RockyJames2-Mar-06 19:53
RockyJames2-Mar-06 19:53 
GeneralRe: Color to Static Control (Urgent pls) Pin
Naveen2-Mar-06 20:34
Naveen2-Mar-06 20:34 
AnswerRe: Color to Static Control (Urgent pls) Pin
Malli_S2-Mar-06 19:56
Malli_S2-Mar-06 19:56 
GeneralRe: Color to Static Control (Urgent pls) Pin
RockyJames2-Mar-06 20:05
RockyJames2-Mar-06 20:05 
GeneralRe: Color to Static Control (Urgent pls) Pin
Malli_S2-Mar-06 20:18
Malli_S2-Mar-06 20:18 
AnswerRe: Color to Static Control (Urgent pls) Pin
Cool Ju2-Mar-06 20:21
Cool Ju2-Mar-06 20:21 
GeneralRe: Color to Static Control (Urgent pls) Pin
RockyJames2-Mar-06 20:53
RockyJames2-Mar-06 20:53 
GeneralRe: Color to Static Control (Urgent pls) Pin
RockyJames2-Mar-06 21:31
RockyJames2-Mar-06 21:31 
AnswerRe: Color to Static Control (Urgent pls) Pin
David Crow3-Mar-06 4:43
David Crow3-Mar-06 4:43 
AnswerRe: Color to Static Control (Urgent pls) Pin
DoctorEd5-Mar-06 10:12
DoctorEd5-Mar-06 10:12 
I had exactly (well ALMOST...) the same requirement. After many inquiries to experienced developers I finally had to find the solution for myself...

1.) Hand-edit the RC file (text mode) to set your static control to OWNER-DRAW. E.G.,
CTEXT "AUTH",IDC_StatAuth1,177,139,28,10,SS_CENTERIMAGE |
SS_SUNKEN | SS_OWNERDRAW | WS_BORDER | NOT WS_GROUP

2.) Override the OnPaint() handler (you don't need the OnCtlColor handler...) an example snippet follows fom the OnPaint() handler:
CWnd* pStat = m_pDlg->GetDlgItem(GetID());
CDC * pDC = pStat->GetDC();
CRect rect;

pStat->GetClientRect(&rect);
pDC->FillSolidRect(&rect, m_nRgbColor);
pDC->SelectObject(m_pDlg->GetMLEDisplayFont()); // Select presized font
pDC->DrawText(m_strText, &rect, DT_VCENTER | DT_CENTER | DT_NOCLIP);
pStat->ReleaseDC(pDC);

The problem is, with static controls is that the background is always drawn by the framework unless you specify owner draw, and the AppWiz (now non-existant in newer VS editions...) never thought of you wanting to owner draw a static control. Thus you have to edit the .rc file by hand.

Work good, no crash!

- Ed.
--------------------------------
QuestionC2491 Error Pin
subramanyeswari2-Mar-06 19:04
subramanyeswari2-Mar-06 19:04 
AnswerRe: C2491 Error Pin
Nibu babu thomas2-Mar-06 19:20
Nibu babu thomas2-Mar-06 19:20 
GeneralRe: C2491 Error Pin
subramanyeswari2-Mar-06 19:50
subramanyeswari2-Mar-06 19:50 
GeneralRe: C2491 Error Pin
Nibu babu thomas2-Mar-06 19:59
Nibu babu thomas2-Mar-06 19:59 
AnswerRe: C2491 Error Pin
Malli_S2-Mar-06 20:04
Malli_S2-Mar-06 20:04 
QuestionDialog Pin
J51219822-Mar-06 18:34
J51219822-Mar-06 18:34 
AnswerRe: Dialog Pin
Nibu babu thomas2-Mar-06 18:41
Nibu babu thomas2-Mar-06 18:41 
QuestionTCP/IP define a IP address a 32b int Pin
derek72-Mar-06 14:11
derek72-Mar-06 14:11 

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.