100分不够再加。。。。新手的入门第四贴:如何自己做一个类继承自系统的类。希望有详细步骤哦。 public class MyButton : Button{ public GetName(string str) { return "my name is " + str; }} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 定义一个只读的文本狂,颜色自定义:public class ReadTextBox : System.Windows.Forms.TextBox { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; public ReadTextBox(System.ComponentModel.IContainer container) { /// /// Windows.Forms 类撰写设计器支持所必需的 /// container.Add(this); InitializeComponent(); this.EnabledChanged +=new System.EventHandler(Change_Enable); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } public ReadTextBox() { /// /// Windows.Forms 类撰写设计器支持所必需的 /// InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region "ChangeTextColor" public void ChangeTextColor(bool blRead) { if(blRead) { this.BackColor = dental.AppShare.DisableBackColor; this.ForeColor = dental.AppShare.DisableForeColor; } else { this.BackColor = System.Drawing.SystemColors.Window; this.ForeColor = System.Drawing.SystemColors.WindowText; } } #endregion #region 组件设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { components = new System.ComponentModel.Container(); this.ReadOnly=true; this.BackColor = dental.AppShare.DisableBackColor; this.ForeColor = dental.AppShare.DisableForeColor; } #endregion #region "Event" private void Lost_Focus(object sender,System.EventArgs e) { System.Windows.Forms.TextBox txt=sender as System.Windows.Forms.TextBox; txt.SelectionStart = 0; txt.SelectionLength = 0; } private void Change_Enable(object sender,System.EventArgs e) { this.ForeColor = System.Drawing.SystemColors.WindowText; } #endregion } public class MyButton : Button{ } 不知道如何继承C++dll中的类??有人知道吗??? drawImage失真 c#中对于多态的定义是什么?怎么说什么定义的都有啊???? FTP服务器没有密码,ftpwebrequest怎么设置 各位兄弟,高手,帮忙用C#做下几题程序题!! 100分 ,ArcGis server 局部刷新地图, 只刷新地图,不刷新整个页面 ,急贴。。。。。。。。。 问一个关于数码相机和USB 开发的问题 如何在提交一条记录时验证其有无重复 大家帮我看看为什么我这样写不能更新数据库 C#桌面程序一进断点就无响应 mainmenu,menuitem的背景色和字體顏色 帮我看看这句话 xslt问题,急
public class ReadTextBox : System.Windows.Forms.TextBox
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public ReadTextBox(System.ComponentModel.IContainer container)
{
///
/// Windows.Forms 类撰写设计器支持所必需的
///
container.Add(this);
InitializeComponent();
this.EnabledChanged +=new System.EventHandler(Change_Enable);
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} public ReadTextBox()
{
///
/// Windows.Forms 类撰写设计器支持所必需的
///
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region "ChangeTextColor"
public void ChangeTextColor(bool blRead)
{
if(blRead)
{
this.BackColor = dental.AppShare.DisableBackColor;
this.ForeColor = dental.AppShare.DisableForeColor;
}
else
{
this.BackColor = System.Drawing.SystemColors.Window;
this.ForeColor = System.Drawing.SystemColors.WindowText;
}
}
#endregion #region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ReadOnly=true;
this.BackColor = dental.AppShare.DisableBackColor;
this.ForeColor = dental.AppShare.DisableForeColor;
}
#endregion #region "Event"
private void Lost_Focus(object sender,System.EventArgs e)
{
System.Windows.Forms.TextBox txt=sender as System.Windows.Forms.TextBox;
txt.SelectionStart = 0;
txt.SelectionLength = 0; }
private void Change_Enable(object sender,System.EventArgs e)
{
this.ForeColor = System.Drawing.SystemColors.WindowText;
}
#endregion
}
{
}
有人知道吗???