As I said in my comment, you'll have to give more information. (Is this a Windows Forms app? ASP.Net?)
The fundamental approach is:
- Find out the DPI of the output device in question. (It's frequently 96 [96 dots per inch], but you cannot assume that.) This thread may help you do that, if it's a Windows Forms app. Also, the Graphics class has the
DpiX and DpiY members, so you can use those.
- Convert the DPI to DPC [dots-per-centimeter] (DPC = DPI / 2.54).
- Multiply your number of centimeters by your DPC value.