Click here to Skip to main content
15,888,239 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to Convert MFC based Windows application to web application Pin
Munchies_Matt9-Apr-14 4:58
Munchies_Matt9-Apr-14 4:58 
AnswerRe: how to Convert MFC based Windows application to web application Pin
Richard MacCutchan9-Apr-14 6:24
mveRichard MacCutchan9-Apr-14 6:24 
GeneralRe: how to Convert MFC based Windows application to web application Pin
Munchies_Matt9-Apr-14 10:54
Munchies_Matt9-Apr-14 10:54 
Questionvisual c++ code to read number of characters in the string entered in a text box Pin
Member 107151068-Apr-14 16:14
Member 107151068-Apr-14 16:14 
AnswerRe: visual c++ code to read number of characters in the string entered in a text box Pin
David Crow8-Apr-14 16:48
David Crow8-Apr-14 16:48 
GeneralRe: visual c++ code to read number of characters in the string entered in a text box Pin
Munchies_Matt9-Apr-14 10:56
Munchies_Matt9-Apr-14 10:56 
AnswerRe: visual c++ code to read number of characters in the string entered in a text box Pin
leon de boer21-Apr-14 23:25
leon de boer21-Apr-14 23:25 
QuestionNeed help on MemDC , Drawtext() coding Pin
econy8-Apr-14 10:08
econy8-Apr-14 10:08 
Hi,with the following code, I marked 3 statements, with the following statements, nothing on the screen,I mean no "TEST,TEST" string and no black box.
C++
pStatic->GetWindowRect(&rect);  //display nothing
ScreenToClient(&rect);          //display nothing


while with
C++
/pStatic->GetClientRect(&rect);  //Display well

"TEST,TEST",black background box display well.
Is anybody know the reason?
Thanks

C++
void CStaticTextTstDlg::OnPaint()
{
  if (IsIconic())
  {
    ...
  }
  else
  {
    CDC *pDC = GetDC();
    CBitmap memBmp;
    CBitmap *pBmpOld;
    CDC memDC;

    CStatic *pStatic = (CStatic*)GetDlgItem(IDC_STATIC_TXT1);
    pStatic->ModifyStyle(0, BS_OWNERDRAW); 

    CRect rect;
   //pStatic->GetClientRect(&rect);  //Display well
    pStatic->GetWindowRect(&rect);  //display nothing
    ScreenToClient(&rect);          //display nothing
		
    memBmp.CreateCompatibleBitmap(pDC,176,50);
    memDC.CreateCompatibleDC(NULL);
    pBmpOld = memDC.SelectObject(&memBmp);

    memDC.SetTextColor(RGB(0,230,0));
    memDC.SetBkMode(TRANSPARENT);
    memDC.FillSolidRect(rect.left,rect.top,176,50,RGB(0,0,0));

    memDC.DrawText(_T("TEST   TEST"),-1,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
		
   CPaintDC dc(this);
  
    dc.BitBlt(137,107,176,50,&memDC,rect.left,rect.top,SRCCOPY);  
		
    memDC.SelectObject(pBmpOld);
    memBmp.DeleteObject();
    memDC.DeleteDC();
    CDialog::OnPaint();

  }

}


Thanks

modified 9-Apr-14 9:20am.

AnswerRe: Need help on MemDC , Drawtext() coding Pin
leon de boer22-Apr-14 21:30
leon de boer22-Apr-14 21:30 
QuestionCDC exist or not question Pin
econy8-Apr-14 2:28
econy8-Apr-14 2:28 
AnswerRe: CDC exist or not question Pin
econy8-Apr-14 2:37
econy8-Apr-14 2:37 
GeneralRe: CDC exist or not question Pin
CPallini8-Apr-14 4:02
mveCPallini8-Apr-14 4:02 
GeneralRe: CDC exist or not question Pin
econy8-Apr-14 4:29
econy8-Apr-14 4:29 
GeneralRe: CDC exist or not question Pin
CPallini8-Apr-14 11:09
mveCPallini8-Apr-14 11:09 
GeneralRe: CDC exist or not question Pin
econy8-Apr-14 12:47
econy8-Apr-14 12:47 
GeneralRe: CDC exist or not question Pin
CPallini8-Apr-14 21:36
mveCPallini8-Apr-14 21:36 
AnswerRe: CDC exist or not question Pin
Joe Woodbury24-Apr-14 9:30
professionalJoe Woodbury24-Apr-14 9:30 
QuestionSetWindowText Blinking problem Pin
econy7-Apr-14 6:00
econy7-Apr-14 6:00 
AnswerRe: SetWindowText Blinking problem Pin
Richard MacCutchan7-Apr-14 6:06
mveRichard MacCutchan7-Apr-14 6:06 
GeneralRe: SetWindowText Blinking problem Pin
econy7-Apr-14 6:46
econy7-Apr-14 6:46 
GeneralRe: SetWindowText Blinking problem Pin
Richard MacCutchan7-Apr-14 6:55
mveRichard MacCutchan7-Apr-14 6:55 
QuestionRe: SetWindowText Blinking problem Pin
David Crow7-Apr-14 16:39
David Crow7-Apr-14 16:39 
AnswerRe: SetWindowText Blinking problem Pin
willcoxson7-Apr-14 18:17
willcoxson7-Apr-14 18:17 
GeneralRe: SetWindowText Blinking problem Pin
econy8-Apr-14 2:26
econy8-Apr-14 2:26 
QuestionC++ - code executed upon definite program termination Pin
liquid_5-Apr-14 20:21
liquid_5-Apr-14 20:21 

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.