Home » Source Code » » setdpi.h

setdpi.h ( File view )

From:
  • By 2010-08-22
  • View(s):9
  • Download(s):0
  • Point(s): 1
			/****************************************************

   Set dialog DPI helper class

   Use this class to make your dialog-editor based 
   dialogs look the same under any Windows DPI 
   settings (Large font mode).
   
   This is important if your dialogs have bitmaps on 
   them. You can specify current DPI if you want 
   bitmaps to get resized to current DPI (normally
   they don't get resized).

   Copyright (C)2003 by George Yohng 
   http://www.yohng.com

   LICENSE AGREEMENT:

      You agree to go to http://www.yohng.com/music.html
      and listen completely (without skips) to the very
      first track on the list.

 ****************************************************/

/*  

 *************************************************
 * Warning: for proper sizing with large fonts,  *
 *          set dialog font explicitly to        *
 *                                               *
 *         Microsoft Sans Serif (as opposed to   *
 *                                MS Sans Serif) *
 *          or Tahoma                            *
 *                                               *
 *          (they have the same sizes)           *
 *************************************************

   // -------------------------------------------------------------------
   // MFC Example:
   // -------------------------------------------------------------------

   ...

   BOOL CMyDlg::OnInitDialog()
   {

       CDialog::OnInitDialog();

       dpi.Attach(AfxFindResourceHandle(IMAKEINTRESOURCE(IDD), RT_DIALOG),
                  m_hWnd,IDD,96.0); // 96 is the DPI

       // The rest of your initialization code goes here

       return TRUE;
   
}

   // -------------------------------------------------------------------
   // ATL/WTL Example:
   // -------------------------------------------------------------------

   ...

   BOOL CMyDlg::OnInitDialog()
   {

       CDialog::OnInitDialog();

       dpi.Attach(_AtlBaseModule.GetResourceInstance(),m_hWnd,IDD,96.0);
       //                                                         ^^^^ DPI

       // The rest of your initialization code goes here

       return TRUE;
   
}

*/

#ifndef SETDPI_INCLUDED
#define SETDPI_INCLUDED

class CSetDPI
{

public:
    int IDD;
    HINSTANCE inst;
    HWND hwnd;
    HFONT font,oldfont;

    CSetDPI();

    void Attach(HINSTANCE inst,HWND dlg,int IDD,double dpi);

    void Detach();

    ~CSetDPI();

};

#endif
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
auCircularBuffer.h11.12 kB04-03-07 13:43
auStatBuffer.h7.43 kB04-03-07 13:43
auUtility.cpp1.16 kB04-03-07 13:43
auUtility.h2.19 kB04-03-07 13:43
fish.bmp52.79 kB11-08-05 15:50
fish_setup.bmp39.78 kB05-06-05 20:26
shark.bmp52.79 kB05-06-05 20:26
shark_setup.bmp39.78 kB05-06-05 20:26
title.bmp210.99 kB18-08-05 20:12
water.bmp474.66 kB18-08-05 20:35
GPL.txt17.89 kB04-03-07 14:10
Readme.txt2.63 kB04-03-07 14:02
cursor1.cur326.00 B12-06-05 02:27
WatorSaver.ico24.62 kB19-08-05 19:16
_WatorSaver.ico21.12 kB29-03-03 10:10
resource.h1.64 kB16-10-05 01:42
setdpi.cpp12.55 kB03-07-05 22:17
setdpi.h2.46 kB17-11-03 02:41
stdafx.cpp793.00 B04-03-07 13:43
stdafx.h2.76 kB04-03-07 13:43
suStringTokens.h4.73 kB04-03-07 13:43
suUtility.h1.16 kB29-05-05 21:00
WatorApp.cpp7.26 kB04-03-07 13:43
WatorApp.h1.94 kB04-03-07 13:43
WatorDlg.cpp12.87 kB04-03-07 13:43
WatorDlg.h2.62 kB04-03-07 13:43
WatorSaver.rc7.17 kB16-10-05 01:42
WatorSaver.sln879.00 B22-11-06 20:36
WatorSaver.vcproj6.84 kB04-03-07 13:43
WatorSaver_VS2003.sln916.00 B22-11-06 22:10
WatorSaver_VS2003.vcproj5.75 kB17-08-05 23:30
WatorSaver.scr968.00 kB22-11-06 22:08
WatorWnd.cpp31.34 kB04-03-07 13:43
WatorWnd.h5.16 kB04-03-07 13:43
wuParameter.cpp2.97 kB04-03-07 13:43
wuParameter.h1.70 kB04-03-07 13:43
<WatorScreenSaver_Binary>0.00 B13-09-08 11:49
<bitmap>0.00 B13-09-08 11:49
<res>0.00 B13-09-08 11:49
<WatorScreenSaver_Binary>0.00 B13-09-08 11:49
<WatorScreenSaver>0.00 B01-10-08 10:11
...
Sponsored links

setdpi.h (763.05 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D