toolbarimagebutton.cs
来自「该项目中对 SQLHelper 类进行了简单封装」· CS 代码 · 共 105 行
CS
105 行
/*
* ToolbarImageButton.cs @Microsoft Visual Studio 2008 <.NET Framework 3.5>
* AfritXia
* 2006-07-20
*
* Copyright(c) http://www.AfritXia.NET/
*
*/
using System;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace NET.AfritXia.Components.Web.TextPane
{
/// <summary>
/// 工具条图片按钮类
/// </summary>
internal class ToolbarImageButton : System.Web.UI.HtmlControls.HtmlImage, INamingContainer, IClientRunTime
{
// 命令名称
private string m_commandName = "CMD_EMPTY";
#region 类 ToolbarImageButton 构造器
/// <summary>
/// 类 ToolbarImageButton 默认构造器
/// </summary>
private ToolbarImageButton()
: base()
{
}
/// <summary>
/// 类 ToolbarImageButton 参数构造器
/// </summary>
/// <param name="imgSrc">图片链接地址</param>
/// <param name="commandName">命令名称</param>
public ToolbarImageButton(string imgSrc, string commandName)
: this()
{
this.Src = imgSrc;
if (commandName != null && commandName != "")
this.m_commandName = commandName;
}
#endregion
/// <summary>
/// 获取命令名称
/// </summary>
public string CommandName
{
get
{
return this.m_commandName;
}
}
/// <summary>
/// 在绘制控件之前,添加控件属性
/// </summary>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
// 添加 CSS 样式表属性
this.Attributes.Add("class", "CToolbarImageButton");
// 添加 ID 属性
this.Attributes.Add("id", this.UniqueID);
}
/// <summary>
/// 建立新的工具条按钮
/// </summary>
/// <param name="imgSrc">按钮图片源</param>
/// <param name="commandName">命令名称</param>
/// <returns>工具条图片按钮对象</returns>
public static ToolbarImageButton Create(string resID, string commandName)
{
// 获取工具提示字符串
string toolTipString = ToolTips.TheInstance.GetString(commandName);
// 建立工具条图片按钮控件
ToolbarImageButton imageButton = new ToolbarImageButton(ResourceGetter.GetResourcesURL(resID), commandName);
// 设置提示字符串
imageButton.Alt = toolTipString;
// 设置标题提示信息
imageButton.Attributes.Add("title", toolTipString);
return imageButton;
}
#region IClientRunTime 成员
public string CreateJavaScriptObject()
{
return string.Format("new CToolbarImageButton('{0}', '{1}');", this.UniqueID, this.CommandName);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?