DataGridView 锁定在继承的 UserControl 上 [英] DataGridView locked on a inherited UserControl

查看:27
本文介绍了DataGridView 锁定在继承的 UserControl 上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一些预定义控件(groupbox、button、datagridview)的 UserControl,这些控件被标记为受保护,组件变量也被标记为受保护.

I have a UserControl with some predefined controls (groupbox,button,datagridview) on it, these controls are marked as protected and the components variable is also marked as protected.

然后我想从这个基 UserControl 继承到另一个 UserControl,但是 DataGridView 总是在设计器中被锁定.

I then want to inherit from this base UserControl to another UserControl, however the DataGridView is always locked in the designer.

我怀疑它可能与实现 ISupportInitilize 的 DataGridView 有关.

I suspect it may have something to do with the DataGridView implementing ISupportInitilize.

public class BaseGridDetail : UserControl

定义了 DataGridView 控件(等).

Has a DataGridView control (et al) defined.


public class InheritedDetail : BaseGridDetail

DataGridView 控件被锁定

The DataGridView control is locked


有没有人知道如何在继承后在设计器中使用此控件?


Does anyone have any ideas how to make this control available in the designer after inheritenace?

推荐答案

从表面上看,DataListView(和其他一些控件)不支持视觉继承.有一个连接问题在此处记录,看起来并不乐观.

By the looks of it, DataListView (and some other controls) do not support visual inheritance. There's a connect issue logged here which doesn't look hopeful.

其他表单控件也记录了类似的问题,例如flowlayoutpanel.

There have been similar issues logged with other form controls, e.g. flowlayoutpanel.

我找不到强制视觉继承的方法.

I'm unable to find a way to force visual inheritance.

这是关于 connect 的官方回答:对于此特定版本,DataGridView 并非旨在用于视觉继承.在我们计划未来版本时,我们将牢记您的建议"那是 26/05/2006.

Here's the official answer on connect: "For this particular release, the DataGridView was not designed to be used in visual intheritance. We will keep your suggestion in mind when we plan our future release" That is of 26/05/2006.

更新:发现这篇博文可能有答案

我无法验证博文的声明.看起来可能是有关此问题的最新消息

I was unable to verify the blog post's claims. Looks like might be the latest on this issue

看起来您仍然可以在运行时操作 DataListView,因此您可以设置视觉属性(和其他设置).这不是一个很好的妥协.

It looks like you can still manipulate the DataListView at runtime though, so you might be able to set visual properties (and other settings). It's not a great compromise.

这篇关于DataGridView 锁定在继承的 UserControl 上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆