draw on child canvas
Create an SDI application that incorporates the following object hierarchy. CVeiw<-(Class derived from CWnd)
• The CWnd class should response to all size notifications and resize accordingly. It should maximize itself to utilise the entire client area. • The class should be able to support the following interfaces. • ShowRectangle() - A rectangle should be drawn anywhere within the client area. • ShowCircle() - The first parameter being a structure that defines the dimension and colour of the circle. • Erase All – Clears the canvas. • The above methods within the class should be invoked when the user chooses Draw -> Circle, Draw -> Rectangle, Draw -> Erase from the menu.(Menu should be generated dynamically)
开发者_开发百科I have implemented the class Derived from CWnd and a window as child of CVeiw and added dynamic menu and hanlers of them inside Mainfrm.cpp file.
Now my problem is, How to draw on the canvas of child window when events are handled inside the Mainfrm.cpp??
You can also use the view class as a target for the menu events. Move the handlers out of the application class and into the view.
精彩评论