-
Notifications
You must be signed in to change notification settings - Fork 2
/
setdpi.h
executable file
·96 lines (67 loc) · 2.46 KB
/
setdpi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/****************************************************
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