romlib
1.0
|
00001 #include <extern.h> 00002 #include <windows.h> 00003 00004 class _EXTERN_ rom_DC 00005 { 00006 public: 00007 00008 rom_DC(HDC _dc):DC(_dc){} 00009 00010 int GetLogPixelsX() const throw() 00011 { 00012 return GetDeviceCaps(DC, LOGPIXELSX); 00013 } 00014 00015 int GetLogPixelsY() const throw() 00016 { 00017 return GetDeviceCaps(DC, LOGPIXELSY); 00018 } 00019 00024 int MMVToPix(int _mm) const throw() 00025 { 00026 return GetLogPixelsY()*_mm/2540; 00027 } 00028 00029 protected: 00030 00031 HDC DC; 00032 }; 00033 00034 class _EXTERN_ rom_DCAuto:public rom_DC 00035 { 00036 public: 00037 00038 rom_DCAuto(HDC _dc):rom_DC(_dc){} 00039 00040 ~rom_DCAuto(){DeleteDC(DC);} 00041 00042 operator HDC(){return DC;} 00043 00044 }; 00045 00046 class _EXTERN_ rom_DCDefault:public rom_DC 00047 { 00048 public: 00049 00050 rom_DCDefault():rom_DC(NULL){} 00051 00052 private: 00053 00054 static int LogPixelSx; 00055 00056 static int LogPixelSy; 00057 00058 };