to shutalon(神州无敌) 1.是 public 的 2.的确没有在属性列表里出现。而不是没有看到 3.对该属性 我使用了override 和new 修饰符各试了一遍 都不行
#region PathSeparator private string _pathSeparator = "\\"; /// <summary> /// Gets or sets the delimiter string that the TreeListViewItem path uses /// </summary> [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), DefaultValue("\\")] [Browsable(true), Description("Gets or sets the delimiter string that the TreeListViewItem path uses")] public string PathSeparator { get { return _pathSeparator; } set { _pathSeparator = value; } } #endregion
贴出你的代码,要是这个属性是UserControl有同名的话得使用new关键字 #region CheckBoxes private CheckBoxesTypes checkboxes = CheckBoxesTypes.None; /// <summary> /// Gets or sets a value indicating whether a check box appears next to each item in the control /// </summary> [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), DefaultValue(typeof(CheckBoxesTypes), "None")] [Browsable(true), Description("Gets or sets a value indicating whether a check box appears next to each item in the control")] new public CheckBoxesTypes CheckBoxes { get { return checkboxes; } set { if(checkboxes == value) return; checkboxes = value; checkDirection = value == CheckBoxesTypes.Recursive ? CheckDirection.All : CheckDirection.None; base.CheckBoxes = value == CheckBoxesTypes.None ? false : true; if(Created) Invalidate(); } } #endregion
但是应该都不能显示在属性列表里.
也可能,你增加的属性已经显示在属性列表里了,只不过你没有看见而已;
也能,你增加的属性的名字和 UserControl 类的某个原有的属性同名,以至于被隐藏了
....
1.是 public 的
2.的确没有在属性列表里出现。而不是没有看到
3.对该属性 我使用了override 和new 修饰符各试了一遍 都不行
private string _pathSeparator = "\\";
/// <summary>
/// Gets or sets the delimiter string that the TreeListViewItem path uses
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), DefaultValue("\\")]
[Browsable(true), Description("Gets or sets the delimiter string that the TreeListViewItem path uses")]
public string PathSeparator
{
get
{
return _pathSeparator;
}
set
{
_pathSeparator = value;
}
}
#endregion
该属性原来叫Text不行
该为MyText后出来了
可是。如果我不写该属性他也不出现
写了该属性后不论用override 还是new 也都不出现
#region CheckBoxes
private CheckBoxesTypes checkboxes = CheckBoxesTypes.None;
/// <summary>
/// Gets or sets a value indicating whether a check box appears next to each item in the control
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), DefaultValue(typeof(CheckBoxesTypes), "None")]
[Browsable(true), Description("Gets or sets a value indicating whether a check box appears next to each item in the control")]
new public CheckBoxesTypes CheckBoxes
{
get
{
return checkboxes;
}
set
{
if(checkboxes == value) return;
checkboxes = value;
checkDirection = value == CheckBoxesTypes.Recursive ? CheckDirection.All : CheckDirection.None;
base.CheckBoxes = value == CheckBoxesTypes.None ? false : true;
if(Created)
Invalidate();
}
}
#endregion
我用CategoryAttibute。可是没有效果啊。为什么呢?
public string MyText
{
set{....}
get{....}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]