Click here to Skip to main content
15,928,535 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionButton disappears after OnPaint() Pin
mfranco_neto29-Aug-06 16:08
mfranco_neto29-Aug-06 16:08 
AnswerRe: Button disappears after OnPaint() Pin
Nishad S29-Aug-06 18:39
Nishad S29-Aug-06 18:39 
GeneralRe: Button disappears after OnPaint() Pin
mfranco_neto30-Aug-06 12:04
mfranco_neto30-Aug-06 12:04 
GeneralRe: Button disappears after OnPaint() Pin
Nishad S30-Aug-06 17:33
Nishad S30-Aug-06 17:33 
GeneralRe: Button disappears after OnPaint() Pin
mfranco_neto31-Aug-06 2:53
mfranco_neto31-Aug-06 2:53 
GeneralRe: Button disappears after OnPaint() Pin
Nishad S31-Aug-06 3:33
Nishad S31-Aug-06 3:33 
GeneralRe: Button disappears after OnPaint() Pin
mfranco_neto31-Aug-06 12:04
mfranco_neto31-Aug-06 12:04 
GeneralRe: Button disappears after OnPaint() Pin
Nishad S31-Aug-06 19:04
Nishad S31-Aug-06 19:04 
Smile | :)
OK... You don't need to handle the any paint messages to change the color of a static text control. You just handle OnCtrlColor().


mfranco_neto wrote:
I feel very lost right now...


Don't think like that... Now you know the method that do not lead to static text color handling... Smile | :) Next time you won't waste time in this way.

I am not sure about the results caused by calling BeginPaint inside OnPaint of another window. It is not desirable, because BeginPaint is for optimized painting.

HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
   HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
   if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)<br />
   {<br />
      pDC->SetTextColor(RGB(255, 0, 0));<br />
      pDC->SetBkMode(TRANSPARENT);<br />
      hbr = GetStockObject( NULL_BRUSH );<br />
   }<br />
<br />
   return hbr;<br />
}

The above code may help you.


- NS -

GeneralRe: Button disappears after OnPaint() Pin
mfranco_neto1-Sep-06 3:35
mfranco_neto1-Sep-06 3:35 
GeneralRe: Button disappears after OnPaint() Pin
mfranco_neto1-Sep-06 4:04
mfranco_neto1-Sep-06 4:04 
GeneralRe: Button disappears after OnPaint() Pin
Nishad S5-Sep-06 18:30
Nishad S5-Sep-06 18:30 
GeneralRe: Button disappears after OnPaint() Pin
mfranco_neto6-Sep-06 15:52
mfranco_neto6-Sep-06 15:52 
Questioncontrol list Pin
With_problem29-Aug-06 16:01
With_problem29-Aug-06 16:01 
AnswerRe: control list Pin
Naveen29-Aug-06 17:33
Naveen29-Aug-06 17:33 
QuestionStand alone function? Pin
Oliver12329-Aug-06 14:43
Oliver12329-Aug-06 14:43 
AnswerRe: Stand alone function? Pin
Chris Losinger29-Aug-06 16:34
professionalChris Losinger29-Aug-06 16:34 
AnswerRe: Stand alone function? Pin
Christopher Duncan30-Aug-06 1:48
Christopher Duncan30-Aug-06 1:48 
Questionusing CHttpConnection with "Proxy-Connection: Keep-Alive" Pin
darbien siamak29-Aug-06 14:38
darbien siamak29-Aug-06 14:38 
QuestionExcel automation function throws exception Pin
garyflet29-Aug-06 13:32
garyflet29-Aug-06 13:32 
AnswerRe: Excel automation function throws exception Pin
Stephen Hewitt29-Aug-06 13:47
Stephen Hewitt29-Aug-06 13:47 
QuestionRe: Excel automation function throws exception Pin
garyflet29-Aug-06 14:39
garyflet29-Aug-06 14:39 
QuestionSetting focus of another application from within an application Pin
si_6929-Aug-06 12:32
si_6929-Aug-06 12:32 
AnswerRe: Setting focus of another application from within an application Pin
Naveen29-Aug-06 17:36
Naveen29-Aug-06 17:36 
AnswerRe: Setting focus of another application from within an application Pin
Hamid_RT30-Aug-06 8:13
Hamid_RT30-Aug-06 8:13 
QuestionCRecordset::isFieldNull question Pin
eusto29-Aug-06 11:12
eusto29-Aug-06 11:12 

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.