[英]C# Winforms inherit usercontrol with objects and modify
I've created my usercontrol called ucn with a datagridview that fills the usercontrol. 我已经创建了一个名为ucn的用户控件,并带有一个填充该用户控件的datagridview。
after I've created another usercontrol inherited from ucn: 创建完另一个从ucn继承的usercontrol之后:
public partial class ucnRequest : ucn
{
and in designmode i see the datagridview: 在设计模式下,我看到了datagridview:
is ok, but I can't add columns for example. 可以,但是我不能添加列。
in the main usercontrol I changed the Modifiers property to public but nothing changes... 在主用户控件中,我将Modifiers属性更改为public,但没有任何更改。
thanks 谢谢
I think this is because your UserControl
will not by default act as a "container" control in the Windows Forms editor, so the Windows Forms editor will not expose its public properties. 我认为这是因为默认情况下,您的UserControl
不会在Windows窗体编辑器中充当“容器”控件,因此Windows窗体编辑器不会公开其公共属性。
To make it a "container" control in the Windows Forms editor you can add the following attribute to the class: 要使其在Windows窗体编辑器中成为“容器”控件,可以将以下属性添加到该类:
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
public class MyUserControl: System.Windows.Forms.UserControl
{
...
See here for more information: http://support.microsoft.com/kb/813450 请参阅此处以获取更多信息: http : //support.microsoft.com/kb/813450
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.