MFC單文件分欄

2021-08-21 15:18:25 字數 1322 閱讀 4513

平台:vs2017

功能:建立單文件程式,並將視窗分成左右兩個;

1. 在cmainframe.h中新增乙個csplitterwnd成員:

中新增以下內容

public:

csplitterwnd msplitwin1;

2 基於cview建立兩個新的檢視類,cviewleft,cviewright;

中新增以下內容

#pragma once

#include"test7201doc.h" //這一行是手動新增的,需要注意的是,*doc.h必須在*view.h前面。

#include "test7201view.h"

class cviewleft :

public ctest7201view

;

中新增以下內容 

#include "stdafx.h"

#include "viewleft.h"

cviewleft::cviewleft()

cviewleft::~cviewleft()

中新增以下內容

#pragma once

#include"test7201doc.h" //這一行是手動新增的,需要注意的是,*doc.h必須在*view.h前面。

#include "test7201view.h"

class cviewright :

public ctest7201view

;

中新增以下內容

#include "stdafx.h"

#include "viewright.h"

cviewright::cviewright()

cviewright::~cviewright()

3 在mainframe.cpp中過載cmainframe的oncreateclient函式;

中新增以下內容

public:

bool cmainframe::oncreateclient(lpcreatestruct lpcs, ccreatecontext*pcontext);

中新增以下內容 

bool cmainframe::oncreateclient(lpcreatestruct lpcs, ccreatecontext*pcontext)

MFC 單文件 建立

據嚮導建立的單文件時候,view類的基類選擇 cformview,這樣可使用控制項 根據嚮導建立單文件,在 使用者介面功能 取消 使用傳統的停靠工具欄 可選 如果支援mysql資料庫 在資料庫支援的頁面 資料庫支援 選擇 不提供檔案支援的資料庫檢視 客戶端型別選 odbc 型別選擇 快照 資料來源 ...

MFC單文件框架理解

mfc程式的整個執行機制需要經過 設計視窗類,註冊視窗類,建立視窗,顯示並更新視窗,訊息迴圈。csingledoctemplate pdoctemplate 定義單文件模板物件指標 pdoctemplate new csingledoctemplate idr mainframe,runtime c...

MFC單文件分割視窗

建立單文件程式 新建兩個對話方塊,用於分割視窗,對話方塊的style屬性改為child,border屬性改為none,最開始沒有改這個,程式執行的時候報錯了。將兩個對話方塊生成從cformview派生的類。在cmainframe中新增兩個成員變數,型別為csplitterwnd,如下所示 cspli...