1. 程式人生 > >MFC小程序

MFC小程序

max tool 通過 this style image 技術分享 -s esc

1.將菜單欄歸零,工具欄放在窗口低部,加載自己新建的工具欄

CMainFrame::OnCreate()函數中 this->SetMenu(0);

技術分享圖片

2.將窗口初始化為最大化

APP類中:m_pMainWnd->ShowWindow(SW_MAXIMIZE);

3.去掉邊框

CMainFrame::PreCreateWindow()函數中 cs.style = WS_POPUP;
4.在FRAME類中添加工具欄命令消息,關閉

通過ON_COMMAND(ToolBar下的圖片ID,實現的函數) this->PostMessage(WM_CLOSE);

5.在VIEW類中添加系統消息keydown

void CDRAWView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)

{

  if(nChar == VK_ESCAPE)

  {

    AfxGetMainWnd()->PostMessage(WM_CLOSE);

  }  

  CView::OnKeyDown(nChar, nRepCnt, nFlags);

}



MFC小程序