Datagridview Class VS 2010工作但不在VS2015中工作 [英] Datagridview Class VS 2010 working but not working in VS2015
本文介绍了Datagridview Class VS 2010工作但不在VS2015中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是VS2015。在我使用VS2010之前。对于Dynamic DataGridView到ProcessDialogKey,我写下以下代码在VC ++中运行良好 2010 Windows窗体。 现在我希望使用该类,但不能正常工作。
Hi, Iam using VS2015. Before I used VS2010. For Dynamic DataGridView to ProcessDialogKey , I write the following code works well in VC++ 2010 Windows forms. Now I wish to use that class, but not working.
收到错误消息'无法加载工具箱项MyDataGrid。它将从工具箱中删除。
Receiving the error message 'Failed to load toolbox item MyDataGrid. It will be removed from the toolbox'.
感谢您的帮助。
我的代码:
MyDataGrid.h
sing namespace System;
using namespace System::Windows::Forms;
#pragma once
public ref class MyDataGrid : DataGridView
{
protected:
virtual bool ProcessDialogKey(Keys keyData) override;
};
MyDataGrid.cpp
#include "StdAfx.h"
#include "MyDataGrid.h"
using namespace System;
using namespace System::Windows::Forms;
bool MyDataGrid::ProcessDialogKey(Keys keyData) {
Keys key = keyData & (System::Windows::Forms::Keys::KeyCode);
if (key == System::Windows::Forms::Keys::Enter) {
DataGridView::OnKeyDown(gcnew KeyEventArgs(keyData));
return true;
}
else {
return DataGridView::ProcessDialogKey(keyData);
}
}
stdafx.h
#pragma once
stdafx.cpp
#include "stdafx.h"
感谢帮助
推荐答案
将编译选项更改为
After compile option change to
公共语言支持:CLR / Pure
Common Language Support : CLR/Pure
我的班级工作正常。
这篇关于Datagridview Class VS 2010工作但不在VS2015中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文