工具栏你可以建立多个工具栏 不同分辨率加载不同的资源
至于控件 InitDialog 中:
//获取未放大前对话框大小
CRect rect; ::GetWindowRect(m_hWnd,rect); ScreenToClient(rect); m_nDlgWidth = rect.right - rect.left; m_nDlgHeight = rect.bottom - rect.top; //窗口最大化,并取得分辨率大小,根据此大小设置控件字体大小 ShowWindow(SW_MAXIMIZE); m_nWidth = GetSystemMetrics(SM_CXSCREEN); m_nHeight = GetSystemMetrics(SM_CYSCREEN); //算出放大倍数,并记录 假设1280*1024 1024*768 800*768 三个分辨率 m_fWidthMul = float(m_nWidth)/float(m_nDlgWidth); m_fHeightMul = float(m_nHeight)/float(m_nDlgHeight); //三种分辨率下设置三种字体,加载不同工具栏 if (m_nWidth >= 1279) { m_newFont.CreateFont(26,0,0,0,FW_NORMAL,0,0,0,1,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH ¦ FF_SWISS,_T("宋体")); m_nToolBarID = IDR_TOOLBAR1; } else { if (m_nWidth >= 1000) { m_newFont.CreateFont(16,0,0,0,FW_NORMAL,0,0,0,1,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH ¦ FF_SWISS,_T("宋体")); m_nToolBarID = IDR_TOOLBAR2; } else { m_newFont.CreateFont(12,0,0,0,FW_NORMAL,0,0,0,1,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH ¦ FF_SWISS,_T("宋体")); m_nToolBarID = IDR_TOOLBAR3; } }
ReSize(控件ID)//有多少个控件 调用多少次resize
类中添加一个函数 ReSize(int nAimID)
void ReSize(nAimID)
{
CRect AimRect; GetDlgItem(nAimID)->GetWindowRect(AimRect); ScreenToClient(AimRect); //记录这个区域的左上角点和右下角点 CPoint OldTLPoint,AimTLPoint; OldTLPoint = AimRect.TopLeft(); AimTLPoint.x = long(OldTLPoint.x *m_fWid
|