You can create multiple toolbar to load different resources at different resolutions.
For controls
InitDialog:
// Obtain the size of the dialog box before the size is greater
CRect rect;
: GetWindowRect (m_hWnd, rect );
ScreenToClient (rect );
M_nDlgWidth = rect. right-rect. left;
M_nDlgHeight = rect. bottom-rect. top;
// Maximize the window size and obtain the resolution. Set the font size of the control based on the size.
ShowWindow (SW_MAXIMIZE );
M_nWidth = GetSystemMetrics (SM_CXSCREEN );
M_nHeight = GetSystemMetrics (SM_CYSCREEN );
// Calculate the magnification and record the three resolutions for the assumption that the resolution is 1280*1024 1024*768 800*768.
M_fWidthMul = float (m_nWidth)/float (m_nDlgWidth );
M_fHeightMul = float (m_nHeight)/float (m_nDlgHeight );
// Set three fonts under three resolutions and load different Toolbar
If (m_nWidth> = 1279)
{
M_newFont.CreateFont (26,0, FW_NORMAL, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH effecff_swiss, _ T (" "));
M_nToolBarID = IDR_TOOLBAR1;
}
Else
{
If (m_nWidth> = 1000)
{
M_newFont.CreateFont (16, 0, FW_NORMAL, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH effecff_swiss, _ T (" "));
M_nToolBarID = IDR_TOOLBAR2;
}
Else
{
M_newFont.CreateFont (, 0, FW_NORMAL, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH effecff_swiss, _ T (" "));
M_nToolBarID = IDR_TOOLBAR3;
}
}
ReSize (Control ID) // number of times that a widget is called resize
Class to add a function ReSize (int nAimID)
Void ReSize (nAimID)
{
CRect AimRect;
GetDlgItem (nAimID)-> GetWindowRect (AimRect );
ScreenToClient (AimRect );
// Record the points in the upper left corner and lower right corner of the area
CPoint OldTLPoint, AimTLPoint;
OldTLPoint = AimRect. TopLeft ();
AimTLPoint. x = long (OldTLPoint. x * m_fWid