窗体控件开发
button,listView的属性被修改后,无法保存,编译就属性内容就消失了
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
namespace SDDev.Forms
{
/// <summary>
/// ButtonListview 的摘要说明。
/// </summary>
public class ButtonListview:Panel
{
private System.Windows.Forms.Button mbutton;
private System.Windows.Forms.ListView mlistView;
private System.ComponentModel.Container components = null;
public ButtonListview()
{
///
/// Windows.Forms 类撰写设计器支持所必需的
///
InitializeComponent();
this.Controls.Add(this.mbutton);
this.Controls.Add(this.mlistView);
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
[
Category("listView"),
Description("listView"),
Browsable(true),
NotifyParentProperty(true),
Bindable(true)
]
public ListView listView
{
get {return mlistView;}
set {mlistView=value;}
}
[
Category("button"),
Description("button"),
Browsable(true),
NotifyParentProperty(true),
]
public Button button
{
get {return mbutton;}
set {mbutton=value;}
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.mbutton = new System.Windows.Forms.Button();
this.mlistView = new System.Windows.Forms.ListView();
//
// mbutton
//
this.mbutton.Location = new System.Drawing.Point(0, 0);
this.mbutton.Name = "mbutton";
this.mbutton.TabIndex = 0;
this.mbutton.Text = "mbutton";
//
// mlistView
//
this.mlistView.Location = new System.Drawing.Point(0, 0);
this.mlistView.Name = "mlistView";
this.mlistView.TabIndex = 0;
}
#endregion
}
}