我使用填充用户控件的 datagridview 创建了名为 ucn 的用户控件。
在我创建了另一个从ucn继承的用户控件之后:
public partial class ucnRequest : ucn
{
在设计模式下我看到了datagridview:
没问题,但我无法添加列。
在主用户控件中,我将 Modifiers 属性更改为公共(public),但没有任何变化...
谢谢
最佳答案
我认为这是因为您的 UserControl
默认情况下不会充当 Windows 窗体编辑器中的“容器”控件,因此 Windows 窗体编辑器不会公开其公共(public)属性。
要使其成为 Windows 窗体编辑器中的“容器”控件,您可以向该类添加以下属性:
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
public class MyUserControl: System.Windows.Forms.UserControl
{
...
请参阅此处了解更多信息:http://support.microsoft.com/kb/813450
关于C# Winforms 用对象继承用户控件并修改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16956734/