Click here to Skip to main content
15,920,576 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralFont Size Pin
TssPrasad24-Aug-05 18:22
sussTssPrasad24-Aug-05 18:22 
GeneralRe: Font Size Pin
MailtoGops24-Aug-05 19:29
MailtoGops24-Aug-05 19:29 
GeneralRe: Font Size Pin
TssPrasad24-Aug-05 19:54
sussTssPrasad24-Aug-05 19:54 
GeneralRe: Font Size Pin
Aamir Butt25-Aug-05 0:46
Aamir Butt25-Aug-05 0:46 
GeneralClearing the Buffer in a MFC View Pin
suzie10024-Aug-05 16:51
suzie10024-Aug-05 16:51 
GeneralRe: Clearing the Buffer in a MFC View Pin
Christian Graus24-Aug-05 17:31
protectorChristian Graus24-Aug-05 17:31 
GeneralRe: Clearing the Buffer in a MFC View Pin
suzie10024-Aug-05 18:50
suzie10024-Aug-05 18:50 
GeneralRe: Clearing the Buffer in a MFC View Pin
MailtoGops24-Aug-05 19:26
MailtoGops24-Aug-05 19:26 
Hi Susmita,

I could not give you answer still I haven't understood what you do in displaying the text in output view.

1. Is your Output view has OnDraw(...) or OnPaint() message handler to paint your document data on the output view?

2. Clear has different meanings.. Clear the View means do you want to clear the data which is stored in Document object?

3. OR you won't clear the document object content, but do you want to display some background color on the view?



For Option 3, what you can do is

1. Have one boolean variable which is funtioning like a toggle

2. When click the button to clear the view, set the bool to true (bClear = true. Now you have to Invalidate the view/window(Which will send WM_PAINT Message and call your OnDraw / OnPaint Message handler)

3. In the OnDraw/OnPaint handler check for the boolean flag (bClear)

4. if bClear is true, then do not call any paint related function


Sample Code

IMPLEMENT_DYNCREATE(CPaintTestView, CView)

BEGIN_MESSAGE_MAP(CPaintTestView, CView)
//{{AFX_MSG_MAP(CPaintTestView)
ON_COMMAND(ID_VIEW_CLEAR, OnViewClear)
ON_UPDATE_COMMAND_UI(ID_VIEW_CLEAR, OnUpdateViewClear)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

..
..
...

CPaintTestView::CPaintTestView()
{
m_bClear = false;

}


/////////////////////////////////////////////////////////////////////////////
// CPaintTestView drawing

void CPaintTestView::OnDraw(CDC* pDC)
{
CPaintTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (m_bClear)
{
}
else
{
pDC->TextOut (20,20,"I Love Bangalore");
}

}


void CPaintTestView::OnViewClear()
{
m_bClear = !m_bClear;
InvalidateRect(NULL,true);
}

void CPaintTestView::OnUpdateViewClear(CCmdUI* pCmdUI)
{
if (m_bClear)
{
pCmdUI->SetCheck ();
}
else
{
pCmdUI->SetCheck (false);
}

}


I hope this will help you..





" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "

- Words from Nelson Mandela

Thanks & Regards,

Gopalakrishnan
QuestionHow to drag a customaze struct and drop? Pin
freehawk24-Aug-05 15:54
freehawk24-Aug-05 15:54 
GeneralERROR_MORE_DATA on RegQueryValueEx() Pin
KingTermite24-Aug-05 14:43
KingTermite24-Aug-05 14:43 
GeneralRe: ERROR_MORE_DATA on RegQueryValueEx() Pin
KingTermite25-Aug-05 4:28
KingTermite25-Aug-05 4:28 
GeneralRe: ERROR_MORE_DATA on RegQueryValueEx() Pin
Blake Miller25-Aug-05 4:59
Blake Miller25-Aug-05 4:59 
GeneralRe: ERROR_MORE_DATA on RegQueryValueEx() Pin
KingTermite25-Aug-05 5:15
KingTermite25-Aug-05 5:15 
GeneralRe: ERROR_MORE_DATA on RegQueryValueEx() Pin
Blake Miller25-Aug-05 5:37
Blake Miller25-Aug-05 5:37 
GeneralNo runnable debuggees error in 'g' Pin
valerie9924-Aug-05 12:11
valerie9924-Aug-05 12:11 
AnswerRe: No runnable debuggees error in Pin
Shog924-Aug-05 13:07
sitebuilderShog924-Aug-05 13:07 
Generalthanks! seems like it repeat with .ecxr Pin
valerie9925-Aug-05 4:00
valerie9925-Aug-05 4:00 
GeneralRe: thanks! seems like it repeat with .ecxr Pin
Blake Miller25-Aug-05 5:04
Blake Miller25-Aug-05 5:04 
Generalhere is what I got... Pin
valerie9925-Aug-05 5:34
valerie9925-Aug-05 5:34 
GeneralRe: here is what I got... Pin
Blake Miller25-Aug-05 5:43
Blake Miller25-Aug-05 5:43 
Generalyou are amazing! Pin
valerie9925-Aug-05 5:59
valerie9925-Aug-05 5:59 
GeneralMFC regular DLL Pin
LeeeNN24-Aug-05 11:29
LeeeNN24-Aug-05 11:29 
AnswerRe: MFC regular DLL Pin
Shog924-Aug-05 13:09
sitebuilderShog924-Aug-05 13:09 
GeneralRe: MFC regular DLL Pin
LeeeNN24-Aug-05 13:51
LeeeNN24-Aug-05 13:51 
GeneralRe: MFC regular DLL Pin
Christian Graus24-Aug-05 14:07
protectorChristian Graus24-Aug-05 14:07 

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.