Re: Displaying Text




"David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx> wrote in message news:9eOji.3771$bz7.493@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx


It's always bothered me that when I resize my main window, all the controls within it flicker, including the toolbar and view areas. I believe there's some sort of CS_ style that could stop this, something like CS_CLIPCHILDREN, or even overriding CMainFrame::OnEraseBackground() to do nothing, as you say. Do you know of any way of stopping this? I just haven't had time to research it.

I am getting very vague on this now, but some time ago I was having problems drawing the background of my CMainFrame in my MDI application. All I wanted was a user-selectable colour :-)

Anyway I remember it as being much more complicated than just CMainFrame::OnEraseBkgnd() and my source code for doing it now has a somewhat enigmatic reference to knowledge-base article

http://support.microsoft.com/kb/129471/EN-US/

I'd have to do some research to remember how the following works (or even why I did it!) but I offer it in case it is of some use. The upshot is that my CMainFrame has a member

CMyMdiClientWnd m_wndMDIClient;

This is a very simple class: in its entirety:

class CMyMdiClientWnd : public CWnd
{
DECLARE_DYNAMIC(CMyMdiClientWnd)

public:

CMyMdiClientWnd();
virtual ~CMyMdiClientWnd();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);

protected:

DECLARE_MESSAGE_MAP()
};

The only non-trivial code in the class implementation is the OnEraseBkgnd() member which draws the background.

And within

CMainFrame::OnCreate()

there is the magic code

if( !m_wndMDIClient.SubclassWindow( m_hWndMDIClient ) )
{
TRACE( _T("Failed to subclass MDI client window\n") );
return -1;
}

I'm not actually drawing anything on top of the background, but I am drawing a gradient fill in the background and it all works very smoothly. I seem to remember that all of the above was necessary to make it do so!

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm

.



Relevant Pages

  • Re: Forum for windows programming?
    ... Use this code as a basic two-mouse-button drawing tool and hack! ... void DebugMSG ... Forward declaration of global data member hwnd. ... struct Color ...
    (alt.comp.lang.learn.c-cpp)
  • Re: if function
    ... the member in the system) and member shape. ... each member is shown on a drawing and called out ... This formatted data is the ... schedule attached to the drawing. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: How to write into CView?
    ... Get rid of GetDlgItem, GetSafeHwnd, and m_hwndRenderWindow. ... Just create a simple member ... If you are drawing to a view, you would have an OnDraw handler for the CView-derived ...
    (microsoft.public.vc.mfc)
  • Re: How to write into CView?
    ... Sorry, I should rephrase my question, ... Joseph had already answered it... ... simple member ... My application looks like the above except that I'm not drawing into the ...
    (microsoft.public.vc.mfc)