共用方式為


CWinFormsView 類別

提供可將 Windows Form 控制項裝載為 MFC 檢視的一般功能。

語法

class CWinFormsView : public CView;

成員

公用建構函式

名稱 描述
CWinFormsView::CWinFormsView 建構 CWinFormsView 物件。

公用方法

名稱 描述
CWinFormsView::GetControl 擷取 Windows Forms 控制項的指標。

公用運算子

名稱 描述
CWinFormsView::operator Control^ 將類型轉換成 Windows Forms 控制項的指標。

備註

MFC 會使用 類別 CWinFormsView 在 MFC 檢視中裝載 .NET Framework Windows Forms 控制項。 控制項是原生檢視的子系,並佔用 MFC 檢視的整個工作區。 結果與 CFormView 檢視類似,可讓您利用 Windows Forms 設計工具與執行時間來建立豐富的表單型檢視。

如需使用 Windows Forms 的詳細資訊,請參閱 在 MFC 中使用 Windows Form 使用者控制項。

注意

MFC Windows Forms 整合僅適用于動態連結 MFC 的專案(定義 AFXDLL 的專案)。

注意

CWinFormsView 不支援 MFC 分隔器視窗 ( CSplitterWnd 類別 )。 目前僅支援 Windows Forms 分隔器控制項。

需求

標頭: afxwinforms.h

CWinFormsView::CWinFormsView

建構 CWinFormsView 物件。

CWinFormsView(System::Type^ pManagedViewType);

參數

pManagedViewType
Windows Forms 使用者控制項資料類型的指標。

範例

在下列範例中,類別 CUserView 繼承自 CWinFormsView ,並將 的型 UserControl1 別傳遞至建 CWinFormsView 構函式。 UserControl1 是 ControlLibrary1.dll 中的自訂建置控制項。

class CMyView : public CWinFormsView

 

IMPLEMENT_DYNCREATE(CMyView, CWinFormsView)

BEGIN_MESSAGE_MAP(CMyView, CWinFormsView)
END_MESSAGE_MAP()

CMyView::CMyView()
    : CWinFormsView(ControlLibrary1::UserControl1::typeid)
{
}

CWinFormsView::GetControl

擷取 Windows Forms 控制項的指標。

System::Windows::Forms::Control^ GetControl() const;

傳回值

System.Windows.Forms.Control 物件的指標。

備註

如需如何使用 Windows Forms 的範例,請參閱 在 MFC 中使用 Windows Form 使用者控制項。

CWinFormsView::operator Control^

將類型轉換成 Windows Forms 控制項的指標。

operator System::Windows::Forms::Control^() const;

備註

此運算子可讓您將檢視傳遞 CWinFormsView 至接受 類型 Control 之 Windows Forms 控制項指標的函式。

範例

請參閱 CWinFormsView::GetControl

另請參閱

階層架構圖表
CWinFormsControl 類別
CWinFormsDialog 類別
CFormView 類別