如何不显示继承的 DataTable 的 Visual Studio 设计器
我的业务对象继承自System.Data.DataTable
。当我从解决方案资源管理器中双击这些类之一时,它会在设计模式下打开并显示“要将组件添加到您的类中,请将它们拖动...”。我希望它像任何其他类一样打开并显示代码。通过使用 Reflector 反编译 DataTable 类,我发现它使用了 Editor 属性。我尝试使用空构造函数将其添加到我的类中,但行为没有改变。我还尝试更改 DesignTimeVisible 属性。以下是数据表的属性:
[Serializable,
XmlSchemaProvider("GetDataTableSchema"),
Editor("Microsoft.VSDesigner.Data.Design.DataTableEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DefaultEvent("RowChanging"),
DesignTimeVisible(false),
DefaultProperty("TableName"),
ToolboxItem(false)]
有什么想法吗?
My business objects inherit from System.Data.DataTable
. When I double-click on one of these classes from the Solution Explorer, it opens in design mode and says "To add components to your class, drag them...". I want it to open like any other class and to show the code. By decompiling the DataTable class using Reflector, I see that it uses the Editor attribute. I tried adding this to my class with an empty constructor, but the behavior didn't change. I also tried changing the DesignTimeVisible attribute. Here are the attributes for a DataTable:
[Serializable,
XmlSchemaProvider("GetDataTableSchema"),
Editor("Microsoft.VSDesigner.Data.Design.DataTableEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DefaultEvent("RowChanging"),
DesignTimeVisible(false),
DefaultProperty("TableName"),
ToolboxItem(false)]
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
右键单击该文件并选择“打开方式...”选择 CSharp 编辑器(或其他)并选择“设置为默认值”
然后单击“确定”。从那时起,双击将在您为该类选择的默认值中打开。
Right click on the file and Select "Open With..." Select CSharp Editor (or whatever) And the select "Set As Default"
Then hit OK. From then on double click will open in whatever you selected as default for that class.