vmehro
asked on
Redrawing window to display new message
I wish to repaint my window so that the appropriate
message is sent as soon as a flag is set.
My code follows:
void CTextView::OnDraw(CDC* pDC)
{
extern int text_out_flag;
int j;
CMainDoc* pDoc = GetDocument();
CRect rect;
GetClientRect(rect);
pDC->SetTextAlign(TA_BASEL INE | TA_CENTER);
// pDC->SetTextColor(pDoc->m_ colorData) ;
pDC->SetBkMode(TRANSPARENT );
// center in the window
if (!text_out_flag)
{
pDC->TextOut(rect.Width() / 2, rect.Height() / 2,
(LPCTSTR)pDoc->GetLine(0), pDoc->GetStringSize());
}
else //if (text_out_flag) //0824
{
CMDIChildWnd *pFrame =
(CMDIChildWnd*)AfxGetApp() ->m_pMainW nd;
pFrame->InvalidateRect(rec t, TRUE);// pDoc->SwitchView();
//pFrame->ValidateRect(rec t);
/* pFrame->RedrawWindow(rect, NULL, RDW_VALIDATE | RDW_UPDATENOW | RDW_ERASE);*/
for (j=0; j<2; j++) {
pDC->TextOut(130, (j+2) * 30,
(LPCTSTR)pDoc->GetLine(j), strlen (pDoc->m_strData[j]) );
}
}
}
When my text_out_flag is 0, I want one message and when it is set to 1, I want another message on my View.
I have tried Invalidate(), RedrawWindow(), etc to no avail.
Please advice.
TIA.
vivek
message is sent as soon as a flag is set.
My code follows:
void CTextView::OnDraw(CDC* pDC)
{
extern int text_out_flag;
int j;
CMainDoc* pDoc = GetDocument();
CRect rect;
GetClientRect(rect);
pDC->SetTextAlign(TA_BASEL
// pDC->SetTextColor(pDoc->m_
pDC->SetBkMode(TRANSPARENT
// center in the window
if (!text_out_flag)
{
pDC->TextOut(rect.Width() / 2, rect.Height() / 2,
(LPCTSTR)pDoc->GetLine(0),
}
else //if (text_out_flag) //0824
{
CMDIChildWnd *pFrame =
(CMDIChildWnd*)AfxGetApp()
pFrame->InvalidateRect(rec
//pFrame->ValidateRect(rec
/* pFrame->RedrawWindow(rect,
for (j=0; j<2; j++) {
pDC->TextOut(130, (j+2) * 30,
(LPCTSTR)pDoc->GetLine(j),
}
}
}
When my text_out_flag is 0, I want one message and when it is set to 1, I want another message on my View.
I have tried Invalidate(), RedrawWindow(), etc to no avail.
Please advice.
TIA.
vivek
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.