// dialogDlg.cpp : implementation file // #include "stdafx.h" #include "dialog.h" #include "dialogDlg.h" //#include ".\dialogdlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDialogDlg dialog CDialogDlg::CDialogDlg(CWnd* pParent /*=NULL*/) : CDialog(CDialogDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_bShow=TRUE; } void CDialogDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDialogDlg) DDX_Control(pDX, IDC_FIND, m_cbFind); DDX_Control(pDX, IDC_STATUSBAR, m_StatusBar); DDX_Control(pDX, IDC_VIEW, m_View); DDX_Control(pDX, IDC_HIDE, m_btnHide); DDX_Control(pDX, IDC_TOOLBAR, m_ToolBar); DDX_Control(pDX, IDC_PANEL, m_Panel); DDX_Control(pDX, IDC_HELPME, m_btnHelp); DDX_Control(pDX, IDC_BACK, m_btnBack); DDX_Control(pDX, IDC_MENU, m_btnMenu); DDX_Control(pDX, IDC_FORE, m_btnFore); DDX_Control(pDX, IDC_DROPDOWN, m_btnDropDown); DDX_Control(pDX, IDC_GO, m_btnGo); DDX_Control(pDX, IDC_MAINTITLE, m_MainTitle); DDX_Control(pDX, IDC_TAB, m_Tab); DDX_Control(pDX, IDC_DOWN, m_btnDown); DDX_Control(pDX, IDC_TITLE, m_Title); DDX_Control(pDX, IDC_UP, m_btnUp); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDialogDlg, CDialog) //{{AFX_MSG_MAP(CDialogDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_SIZE() ON_BN_CLICKED(IDC_HIDE, OnHide) ON_BN_CLICKED(ID_SCHEME, OnScheme) ON_WM_GETMINMAXINFO() ON_COMMAND(ID_SCHEME_BLUE, OnSchemeBlue) ON_COMMAND(ID_SCHEME_SLIVER, OnSchemeSliver) ON_COMMAND(ID_SCHEME_DEFAULT, OnSchemeDefault) ON_COMMAND(ID_SCHEME_GREEN, OnSchemeGreen) //}}AFX_MSG_MAP ON_BN_CLICKED(IDC_GO, OnBnClickedGo) ON_BN_CLICKED(IDC_MENU, OnBnClickedMenu) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDialogDlg message handlers BOOL CDialogDlg::OnInitDialog() { CDialog::OnInitDialog(); ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here // 缺省设置:设置缺省菜单,缺省皮肤; m_nMenuID=ID_SCHEME_DEFAULT; LoadSkin("Themes\\DefaultTheme\\DefaultTheme.ini"); SetWindowPos(NULL,m_BorderSizes.left,m_BorderSizes.top,m_BorderSizes.right,m_BorderSizes.bottom,SWP_NOMOVE); //移动主对话框位置 #if 0 int cx=GetSystemMetrics(SM_CXSCREEN); //屏幕宽度 int cy=GetSystemMetrics(SM_CYSCREEN); //屏幕高度 CRect rectWindow; GetWindowRect(&rectWindow); //得到对话框在屏幕上的坐标区域 int w=rectWindow.Width(); int h=rectWindow.Height(); CRect rc; GetWindowRect(&rc); //MoveWindow(cx-w,cy-h-28-ln,w,h+ln,true);//移动窗体并改变大小 //SetWindowPos(&wndTop,rc.left,rc.top,rc.Width(),rc.Height()+ln,SWP_NOMOVE);//不移动位置,但改变大小 #endif return TRUE; // return TRUE unless you set the focus to a control } void CDialogDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } void CDialogDlg::OnPaint() { CPaintDC dc(this); if (IsIconic()) { // device context for painting //; SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CRect rc; GetClientRect(&rc); m_bmpBottomBorder.ExtendDraw(&dc,CRect(0,rc.Height()-3 ,rc.Width(),rc.Height()),50,0); m_bmpRightBorder.ExtendDraw(&dc,&CRect(rc.Width()-3 ,0,rc.Width(),rc.Height()),0,50); rc.DeflateRect(3,3); //主窗口背景; dc.FillSolidRect(&rc,m_MainWindowBackGround); } } HCURSOR CDialogDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CDialogDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); CRect rc; //Panel m_Panel.GetClientRect(rc); m_Panel.SetWindowPos(NULL,0,40,187,cy-40-3, NULL); m_Tab.SetWindowPos(NULL,0,10,10,10, SWP_NOSIZE); m_Title.SetWindowPos(NULL,m_LeftTitleBarPos.cx ,m_LeftTitleBarPos.cy,154,26, NULL); rc.top =176; m_Panel.RedrawWindow(rc,NULL); //maintitle m_MainTitle.SetWindowPos(NULL,0,0,cx,40, NULL); m_btnGo.SetWindowPos(NULL,cx+m_ButtonGoPos.cx ,m_ButtonGoPos.cy ,0,0, SWP_NOSIZE); m_btnDropDown.SetWindowPos(NULL,cx+m_ButtonGoDropDownPos.cx ,m_ButtonGoDropDownPos.cy ,0,0, SWP_NOSIZE); m_btnHelp.SetWindowPos(NULL,cx+m_ButtonHelpMePos.cx ,m_ButtonHelpMePos.cy,0,0, SWP_NOSIZE); m_btnBack.SetWindowPos(NULL,cx+m_ButtonBackwardPos.cx ,m_ButtonBackwardPos.cy,0,0, SWP_NOSIZE); m_btnFore.SetWindowPos(NULL,cx+m_ButtonForewardPos.cx ,m_ButtonForewardPos.cy,0,0, SWP_NOSIZE); m_btnMenu.SetWindowPos(NULL,cx+m_ButtonMenusPos.cx ,m_ButtonMenusPos.cy,0,0, SWP_NOSIZE); m_cbFind.ShowWindow(SW_HIDE); m_cbFind.SetWindowPos(NULL,77 ,5,cx+m_ButtonGoPos.cx-80,15, NULL); m_cbFind.ShowWindow(SW_SHOW); m_MainTitle.RedrawWindow(); SetViewSize(cx, cy); } void CDialogDlg::OnHide() { CRect rc; GetClientRect(rc); // TODO: Add your control notification handler code here CEnBitmap bmp; if (m_bShow) { m_Panel.ShowWindow(SW_HIDE) ; m_bShow=FALSE; bmp.LoadImage(m_strPathName + "\\" +"ShowLeft.bmp"); } else { m_Panel.ShowWindow(SW_SHOW) ; m_bShow=TRUE; bmp.LoadImage(m_strPathName + "\\" +"HideLeft.bmp"); } m_btnHide.SetBitmap((HBITMAP)bmp.m_hObject); SetViewSize(rc.Width(),rc.Height() ); } void CDialogDlg::LoadSkin(CString strFileName) { // 获取对话框客户区域 [7/21/2013 Zero.t] CRect rc; GetClientRect(&rc); int cx=rc.Width(); int cy=rc.Height(); // 获取皮肤主题路径 [7/21/2013 Zero.t] m_strPathName=GetPathName(strFileName); static const char *ThemeMetrics = "ThemeMetrics"; static const char *ThemeColors = "ThemeColors"; static const char *ThemeColor = "ThemeColor"; char buf[MAX_PATH]; // 获取各贴图信息 [7/21/2013 Zero.t] GetPrivateProfileString(ThemeColors,"MainWindowBackGround","",buf,MAX_PATH,strFileName); // 主窗口背景 [7/21/2013 Zero.t] m_MainWindowBackGround=GetColor(buf); GetPrivateProfileString(ThemeColors,"ExplainViewBackGround","",buf,MAX_PATH,strFileName); // 解释查看背景 [7/21/2013 Zero.t] m_ExplainViewBackGround=GetColor(buf); m_View.SetBKColor(m_ExplainViewBackGround); GetPrivateProfileString(ThemeColors,"ExplainViewBorder","",buf,MAX_PATH,strFileName); // 解释边框 [7/21/2013 Zero.t] m_ExplainViewBorder=GetColor(buf); GetPrivateProfileString(ThemeColors,"NormalText","",buf,MAX_PATH,strFileName); // 正常文本 [7/21/2013 Zero.t] m_NormalText=GetColor(buf); //设置边框 m_bmpBottomBorder.LoadImage(m_strPathName + "\\" + "BottomBorder.bmp") ; m_bmpRightBorder.LoadImage(m_strPathName + "\\" +"RightBorder.bmp") ; GetPrivateProfileString(ThemeMetrics,"BorderSizes","",buf,MAX_PATH,strFileName); m_BorderSizes=GetRect(buf); //Tab m_Panel.LoadBitmap(m_strPathName + "\\" +"LeftPanel.bmp"); //m_Panel.SetExtendPoint(50,40); m_Panel.SetExtendPoint(50,40); // 最好是对半分,原图的大小是100*80 m_Tab.SetParent(&m_Panel); m_Tab.LoadBitmap(m_strPathName + "\\" +"TabBkgrd.bmp"); m_Tab.Clear(); m_Tab.AddTab(m_strPathName + "\\" +"TabIndex.bmp"); m_Tab.AddTab(m_strPathName + "\\" +"TabWizard.bmp"); m_Tab.AddTab(m_strPathName + "\\" +"TabSearch.bmp"); m_Tab.AddTab(m_strPathName + "\\" +"TabAppendix.bmp"); m_Title.LoadBitmap(m_strPathName + "\\" +"LeftTitleBar.bmp") ; m_Title.SetParent(&m_Panel); GetPrivateProfileString(ThemeMetrics,"LeftTitleBarPos","",buf,MAX_PATH,strFileName); m_LeftTitleBarPos=GetSize(buf); m_Title.SetWindowPos(NULL,m_LeftTitleBarPos.cx ,m_LeftTitleBarPos.cy,154,26, NULL); m_Title.SetText("附录",10,RGB(0,0,0)); m_btnUp.SetParent(&m_Title); m_btnUp.SetWindowPos(NULL,90,0,100,100, SWP_NOSIZE); m_btnUp.LoadBitmap(m_strPathName + "\\" +"jumpnext.bmp"); m_btnDown.SetParent(&m_Title); m_btnDown.SetWindowPos(NULL,113,0,100,100, SWP_NOSIZE); m_btnDown.LoadBitmap(m_strPathName + "\\" +"jumpprev.bmp"); /************************************************************************/ /* Skin按钮实例演示过程: // 0.首先,获取对话框的客户区大小(长宽); CRect rc; GetClientRect(&rc); int cx=rc.Width(); // 本例中,cx=792 int cy=rc.Height(); // 本例中,cy=531 // 2.获取按钮剪裁图片在背景图中的位置 // 本例中,m_btnSize={-246,4}; // 其中,要注意的一点是,剪裁图片在原图的位置坐标系,是下面坐标系:x向左为正方向,y向上为正方向; // // x+ // 原图(0,0)----------------> | // | | // | | // x+ --------------btn(0,0)------------------- -x // | // | // | // -y // // 所以,按钮的位置相对原坐标系来说,按钮必须要取x的余值。 // char buf[MAX_PATH]; GetPrivateProfileString(ThemeMetrics,"Go_BtnPos","",buf,MAX_PATH,strFileName); m_btnSize = GetSize(buf); m_btnGo; //查询按钮; // 3.加载按钮图片; m_btnGo.LoadBitmap("go.bmp"); // 4.设置按钮的父窗口; m_btnGo.SetParent(&m_pMainDlg); // 5.设置按钮位置,其中 Width()=0, Height()=0; m_btnGo.SetWindowPos(NULL,cx+m_btnSize.cx,m_btnSize.cy,0,0,SWP_NOSIZE); cx+m_btnSize.cx = 792 - 246 = 546; m_btnSize.cy = 4; //------------------------------------------------------------------------------- // 本例中OnSize的cx=484,cy=462 // cx+m_btnSize.cx = 484 - 246 = 238; // m_btnSize.cy = 4; // 6.然后,在OnSize(UINT nType,int cx, int cy)函数中,实时设置按钮位置; // 以下语句在OnSize里执行,cx与cy是实时改变的父窗口大小; m_btnGo.SetWindowPos(NULL,cx+m_btnSize.cx ,m_btnSize.cy ,0,0, SWP_NOSIZE); //------------------------------------------------------------------------------- */ /************************************************************************/ //MainTitle m_MainTitle.LoadBitmap(m_strPathName + "\\" +"MainTitle.bmp"); //m_MainTitle.SetExtendPoint(100,0); m_MainTitle.SetExtendPoint(100,0); m_MainTitle.SetText("输入:",25,m_NormalText); m_btnGo.LoadBitmap(m_strPathName + "\\" +"Go.bmp"); m_btnGo.SetParent(&m_MainTitle); m_btnDropDown.LoadBitmap(m_strPathName + "\\" +"GoDropDown.bmp"); m_btnDropDown.SetParent(&m_MainTitle); m_btnHelp.LoadBitmap(m_strPathName + "\\" +"HelpMe.bmp"); m_btnHelp.SetParent(&m_MainTitle); m_btnFore.LoadBitmap(m_strPathName + "\\" +"Foreward.bmp"); m_btnFore.SetParent(&m_MainTitle); m_btnBack.LoadBitmap(m_strPathName + "\\" +"Backward.bmp"); m_btnBack.SetParent(&m_MainTitle); m_btnMenu.LoadBitmap(m_strPathName + "\\" +"MENUS.BMP"); m_btnMenu.SetParent(&m_MainTitle); GetPrivateProfileString(ThemeMetrics,"ButtonGoPos","",buf,MAX_PATH,strFileName); m_ButtonGoPos=GetSize(buf); GetPrivateProfileString(ThemeMetrics,"ButtonGoDropDownPos","",buf,MAX_PATH,strFileName); m_ButtonGoDropDownPos=GetSize(buf); GetPrivateProfileString(ThemeMetrics,"ButtonHelpMePos","",buf,MAX_PATH,strFileName); m_ButtonHelpMePos=GetSize(buf); GetPrivateProfileString(ThemeMetrics,"ButtonBackwardPos","",buf,MAX_PATH,strFileName); m_ButtonBackwardPos=GetSize(buf); GetPrivateProfileString(ThemeMetrics,"ButtonForewardPos","",buf,MAX_PATH,strFileName); m_ButtonForewardPos=GetSize(buf); GetPrivateProfileString(ThemeMetrics,"ButtonMenusPos","",buf,MAX_PATH,strFileName); m_ButtonMenusPos=GetSize(buf); m_btnGo.SetWindowPos(NULL,cx+m_ButtonGoPos.cx ,m_ButtonGoPos.cy ,0,0, SWP_NOSIZE); m_btnDropDown.SetWindowPos(NULL,cx+m_ButtonGoDropDownPos.cx ,m_ButtonGoDropDownPos.cy ,0,0, SWP_NOSIZE); m_btnHelp.SetWindowPos(NULL,cx+m_ButtonHelpMePos.cx ,m_ButtonHelpMePos.cy,0,0, SWP_NOSIZE); m_btnBack.SetWindowPos(NULL,cx+m_ButtonBackwardPos.cx ,m_ButtonBackwardPos.cy,0,0, SWP_NOSIZE); m_btnFore.SetWindowPos(NULL,cx+m_ButtonForewardPos.cx ,m_ButtonForewardPos.cy,0,0, SWP_NOSIZE); m_btnMenu.SetWindowPos(NULL,cx+m_ButtonMenusPos.cx ,m_ButtonMenusPos.cy,0,0, SWP_NOSIZE); m_cbFind.SetParent(&m_MainTitle); m_cbFind.SetWindowPos(NULL,77 ,5,cx+m_ButtonGoPos.cx-80,15, NULL); //ToolBar m_ToolBar.LoadTBImage(IDB_TOOLBAR,RGB(255,0,255)); m_ToolBar.LoadBitmap(m_strPathName + "\\" +"RightTitleBar.bmp"); m_ToolBar.SetExtendPoint(50,0); m_btnHide.LoadBitmap(m_strPathName + "\\" +"HideLeft.bmp"); m_btnHide.SetParent(&m_ToolBar); CList lstToolBarCommands; lstToolBarCommands.AddTail (ID_COPY); lstToolBarCommands.AddTail (ID_READ); lstToolBarCommands.AddTail (ID_SAVE); lstToolBarCommands.AddTail (ID_PRINT); lstToolBarCommands.AddTail (ID_FIND); lstToolBarCommands.AddTail (ID_NOTE); m_ToolBar.SetBasicCommands(lstToolBarCommands); m_ToolBar.SetTextColor(m_NormalText); m_ToolBar.SetSizes(CSize(24,24),CSize(16,16)); //View m_View.LoadBKImage(m_strPathName + "\\" +"ViewBkgrd.bmp"); m_View.SetBorderColor(m_ExplainViewBorder); //StatusBar CList lstStatusBarCommands; lstStatusBarCommands.AddTail (ID_SEARCH); lstStatusBarCommands.AddTail (ID_SCHEME); lstStatusBarCommands.AddTail (ID_SETUP); m_StatusBar.SetBasicCommands(lstStatusBarCommands); m_StatusBar.LoadBitmap(m_strPathName + "\\" +"StatusBar.bmp"); m_StatusBar.SetExtendPoint(50,0); m_StatusBar.LoadSBImage(m_strPathName + "\\" +"StatusToolBar.bmp"); GetPrivateProfileString(ThemeColor,"COLOR_FLATBK","",buf,MAX_PATH,strFileName); m_crFlatBK=GetColor(buf); GetPrivateProfileString(ThemeColor,"COLOR_FLATHIGHLIGHT","",buf,MAX_PATH,strFileName); m_crFlatHighLight=GetColor(buf); GetPrivateProfileString(ThemeColor,"COLOR_HIGHLIGHT","",buf,MAX_PATH,strFileName); m_crHighLight=GetColor(buf); GetPrivateProfileString(ThemeColor,"COLOR_FLATGRAY","",buf,MAX_PATH,strFileName); m_crFlatGray=GetColor(buf); GetPrivateProfileString(ThemeColor,"COLOR_BTNSHADOW","",buf,MAX_PATH,strFileName); m_crBtnShadow=GetColor(buf); GetPrivateProfileString(ThemeColor,"COLOR_FLATHIGHLIGHTTEXT","",buf,MAX_PATH,strFileName); m_crFlatHighLightText=GetColor(buf); //更新整个区域 Invalidate(); } void CDialogDlg::SplitString(char *buf,int nCount,CStringList& strList) { char *p1=buf; for (int i=0;i path; p-- ); if ( *p == '\\' || *p == '/') p++; *p = 0; return CString(path); } void CDialogDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { lpMMI->ptMinTrackSize.x=500; lpMMI->ptMinTrackSize.y=500; CDialog::OnGetMinMaxInfo(lpMMI); } void CDialogDlg::OnScheme() { CWnd *pWnd=m_StatusBar.GetDlgItem(ID_SCHEME); CRect rc; pWnd->GetWindowRect(&rc); CSkinMenu m_menu; m_menu.CreatePopupMenu(); m_menu.AppendMenu(MF_ENABLED |MF_OWNERDRAW,ID_SCHEME_DEFAULT,"默认"); m_menu.AppendMenu(MF_ENABLED |MF_OWNERDRAW,ID_SCHEME_BLUE,"蓝色天空"); m_menu.AppendMenu(MF_ENABLED |MF_OWNERDRAW,ID_SCHEME_SLIVER,"银色"); m_menu.AppendMenu(MF_ENABLED |MF_OWNERDRAW,ID_SCHEME_GREEN,_T("橄榄树")); //m_menu.ChangeStyle(0); m_menu.CheckMenuItem(m_nMenuID,MF_BYCOMMAND | MF_CHECKED ); m_menu.SetBKColor(m_crFlatBK,m_crFlatGray); m_menu.SetHighLightColor(m_crFlatHighLight,m_crHighLight,m_crFlatHighLightText,m_crBtnShadow); m_menu.TrackPopupMenu(TPM_CENTERALIGN , rc.left ,rc.bottom ,this,CRect(0,0,101,100)); } void CDialogDlg::OnSchemeBlue() { // TODO: Add your command handler code here LoadSkin("Themes\\BlueTheme\\BlueTheme.ini"); m_nMenuID=ID_SCHEME_BLUE; } void CDialogDlg::OnSchemeSliver() { // TODO: Add your command handler code here LoadSkin("Themes\\SilverTheme\\SilverTheme.ini"); m_nMenuID=ID_SCHEME_SLIVER; } void CDialogDlg::OnSchemeDefault() { // TODO: Add your command handler code here LoadSkin("Themes\\DefaultTheme\\DefaultTheme.ini"); m_nMenuID=ID_SCHEME_DEFAULT; } void CDialogDlg::OnSchemeGreen() { // TODO: Add your command handler code here LoadSkin("Themes\\GreenTheme\\GreenTheme.ini"); m_nMenuID=ID_SCHEME_GREEN; } void CDialogDlg::SetViewSize(int cx, int cy) { if (m_bShow) { m_ToolBar.SetWindowPos(NULL,192,40,cx-192-3,25,NULL); m_ToolBar.Invalidate(); m_btnHide.SetWindowPos(NULL,0,0,10,10,SWP_NOSIZE); m_View.SetWindowPos(NULL,192,65,cx-192-4,cy-27-25-40-3, NULL); m_View.Invalidate(); m_StatusBar.SetWindowPos(NULL,192,cy-27-3,cx-192-3,27, NULL); m_StatusBar.Invalidate(); } else { m_ToolBar.SetWindowPos(NULL,0,40,cx-3,25,NULL); m_ToolBar.Invalidate(); m_btnHide.SetWindowPos(NULL,0,0,10,10,SWP_NOSIZE); m_View.SetWindowPos(NULL,0,65,cx-4,cy-27-25-40-3, NULL); m_View.Invalidate(); m_StatusBar.SetWindowPos(NULL,0,cy-27-3,cx-3,27, NULL); m_StatusBar.Invalidate(); } } void CDialogDlg::OnBnClickedGo() { // TODO: 在此添加控件通知处理程序代码 AfxMessageBox("查询按钮"); } void CDialogDlg::OnBnClickedMenu() { // TODO: 在此添加控件通知处理程序代码 AfxMessageBox("菜单按钮"); } BOOL CDialogDlg::DestroyWindow() { // TODO: 在此添加专用代码和/或调用基类 m_StatusBar.ClearMemory(); m_ToolBar.ClearMemory(); m_Tab.ClearMemory(); return CDialog::DestroyWindow(); }