国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C > 正文

VC實現對話框窗口任意分割

2020-01-26 15:04:27
字體:
來源:轉載
供稿:網友

    個人認為簡單問題最好就是直接貼源代碼,一看就明白,說來說去反而弄不清楚,那我就少廢話了,自己看吧,注釋很清楚。

先來張圖片

1. 新建一個MFC對話框程序MySplitterDlg。 再插入兩個Dialog資源 ,這里一定要選擇IDD_FORMVIEW類別的對話框,分別新建類CMyFormView0 和CMyFormView1,基類別選CDialog,一定要選擇CFormView。

2. CMySplitterDlg中增加WM_CREATE的消息響應,編輯OnCreate()

int CMySplitterDlg::OnCreate(LPCREATESTRUCT lpCreateStruct){  if (CDialog::OnCreate(lpCreateStruct) == -1)    return -1;  // Because the CFRameWnd needs a window class, we will create a new one. I just copied the sample from MSDN Help.  // When using it in your project, you may keep CS_VREDRAW and CS_HREDRAW and then throw the other three parameters.  //需要注冊窗口類  CString strMyClass = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW,           ::LoadCursor(NULL, IDC_ARROW),  (HBRUSH) ::GetStockObject(WHITE_BRUSH),           ::LoadIcon(NULL, IDI_APPLICATION));  // Create the frame window with "this" as the parent  m_pMyFrame = new CFrameWnd;  m_pMyFrame->Create(strMyClass,"", WS_CHILD,  CRect(0,0,300,300), this);  m_pMyFrame->ShowWindow(SW_SHOW);  // and finally, create the splitter with the frame as the parent  m_cSplitter.CreateStatic(m_pMyFrame,1, 2); //在Frame里切分視圖窗口為1×2,就是一行兩列  m_cSplitter.CreateView(0,0, RUNTIME_CLASS(CMyFormView0),  CSize(100,100), NULL);//第一行一列  m_cSplitter.CreateView(0,1, RUNTIME_CLASS(CMyFormView1), CSize(100,100), NULL);//第一行二列   return 0;}

3. 在CMySplitterDlg::OnInitDialog()中顯示Frame

int CMySplitterDlg::OnInitDialog(){CDialog::OnInitDialog();GetWindowRect(&cRect);ScreenToClient(&cRect);m_pMyFrame->MoveWindow(&cRect);m_pMyFrame->ShowWindow(SW_SHOW);return TRUE;}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 安图县| 栾城县| 凤阳县| 萝北县| 潜山县| 贡嘎县| 赣州市| 林芝县| 灵石县| 深泽县| 遵义市| 利津县| 伊春市| 会宁县| 商都县| 区。| 达孜县| 余庆县| 宁武县| 措勤县| 左权县| 梁山县| 东阳市| 连平县| 两当县| 临朐县| 嵊州市| 石台县| 阳新县| 烟台市| 敦化市| 沽源县| 格尔木市| 元阳县| 崇明县| 榆林市| 玛多县| 乌鲁木齐县| 会东县| 盐池县| 兴仁县|