.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

Home >> Articles >> General >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Outputting text and graphics in VC++

Posted By:Abhisek Panda       Posted Date: November 27, 2009    Points: 25    Category: General    URL: http://www.dotnetspark.com  

Outputting text and graphics in VC++ using MFC

      MFC carries out the outputting of text and graphics by using device context. It defines a top-level device context class with the name "CDC".

        This class defines a group of subclasses relating to a particular device. The subclasses defines a set of functions relating to GDI(Graphics Device Interface) to output text and graphics. The various subclasses defined by CDC are as follows,



This device context class can output text and graphics within the client area of the window. It works on the event of ON_WM_PAINT().

This event occures when we interact with a window,i.e, when we open the window, close the window, move the window, resize the window, etc. The ON_WMPAINT() is associated with an event handler,i.e, OnPaint().

int OnPaint()
CPaintDc dc(this);
return (0);


This device context class works with the outputting of text and graphics within the client area. It can work with the events like,

These events occurs when the left mouse button is pressed and released respectively. Similarly there are several button events.

int OnLButtonDown()
CClientDC dc(this);
return (0);


This device context class relates to outputting text and graphics in client area as well as non-client area of a window. It works with the events relating to button and mouse, etc.

int OnRButtonDown()
CWindowDC dc(this);
return (0);


This device context class works with the input, output relating to files. It is also the medium via which data persistence is carried out. In other words CMetaFileDC works with the serialization and deserialization of objects.

(Writing the state of object to a persisted device is called serialization and loading of that object is called as deserialization)
 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend