Compartir a través de


Working with Window Objects

Working with windows calls for two kinds of activity:

  • Handling Windows messages

  • Drawing in the window

To handle Windows messages in any window, including your own child windows, see Mapping Messages to Functions to map the messages to your C++ window class. Then write message-handler member functions in your class.

Most drawing in a framework application occurs in the view, whose OnDraw member function is called whenever the window's contents must be drawn. If your window is a child of the view, you might delegate some of the view's drawing to your child window by having OnDraw call one of your window's member functions.

In any case, you will need a device context for drawing. You can use the stock pen, brush, and other graphic objects contained in the device context associated with your window. Or you can modify these objects to get the drawing effects you need. With your device context set up as you like, call member functions of class CDC (device-context class) to draw lines, shapes, and text; to use colors; and to work with a coordinate system.

What do you want to know more about?

See Also

Concepts

Window Objects