Mfc 如何将System.windows.forms.datagridview插入对话框?
我想在对话框中插入datagridview 所以我添加了它,在这之后,发生了15个错误。为什么会这样 这是代码Mfc 如何将System.windows.forms.datagridview插入对话框?,mfc,datagridview,dialog,Mfc,Datagridview,Dialog,我想在对话框中插入datagridview 所以我添加了它,在这之后,发生了15个错误。为什么会这样 这是代码 // AccessDlg.h : header file // #pragma once #include "stdafx.h" // CAccessDlg dialog class CAccessDlg : public CDialog { // Construction public: CAccessDlg(CWnd* pParent = NULL); // sta
// AccessDlg.h : header file
//
#pragma once
#include "stdafx.h"
// CAccessDlg dialog
class CAccessDlg : public CDialog
{
// Construction
public:
CAccessDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_ACCESS_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
CWinFormsControl<System::Windows::Forms::DataGridView> m_DataGridView;
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
};
void CAccessDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_ManagedControl(pDX, IDC_GridView, m_DataGridView);
}
错误是这样的
error C2143: syntax error : missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C3083: 'Windows': the symbol to the left of a '::' must be a type
error C3083: 'Forms': the symbol to the left of a '::' must be a type
error C2039: 'DataGridView' : is not a member of 'System'
error C2238: unexpected token(s) preceding
您是否包括afxwinforms.h?您应该在stdafx.h中添加以下内容
#include <afxwinforms.h>