📄 imagebutton.cs
字号:
using System;
using System.Collections;
using System.Collections.Specialized;
namespace System.Web.UI.WebControls
{
/// <summary>
/// Summary description for ImageButton.
/// </summary>
public class ImageButton : Image,
System.Web.UI.IPostBackDataHandler,
System.Web.UI.IPostBackEventHandler
{
private static object EventClick;
private static object EventCommand;
private int x;
private int y;
static ImageButton()
{
ImageButton.EventClick = new Object();
ImageButton.EventCommand = new Object();
}
public ImageButton() : base()
{
}
protected virtual void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
{
Page local0;
local0 = this.Page;
if (local0 != null)
local0.VerifyRenderingInServerForm(this);
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Type, "image");
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Name, this.UniqueID);
// if (local0 != null && this.CausesValidation && local0.Validators.Count > 0)
// {
// writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Onclick, System.Web.UI.Util.GetClientValidateEvent(local0));
// writer.AddAttribute("language", "javascript");
// }
this.AddAttributesToRender(writer);
}
protected virtual void OnClick(ImageClickEventArgs e)
{
ImageClickEventHandler local0;
local0 = (ImageClickEventHandler) this.Events[ImageButton.EventClick];
if (local0 != null)
local0(this, e);
}
protected virtual void OnCommand(CommandEventArgs e)
{
CommandEventHandler local0;
local0 = (CommandEventHandler) this.Events[ImageButton.EventCommand];
if (local0 != null)
local0(this, e);
this.RaiseBubbleEvent(this, e);
}
protected virtual void OnPreRender(EventArgs e)
{
if (this.Page != null)
this.Page.RegisterRequiresPostBack(this);
}
bool System.Web.UI.IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
{
string local0;
string local1;
string local2;
local0 = this.UniqueID;
local1 = postCollection[local0 + ".x"];
local2 = postCollection[local0 + ".y"];
if (local1 != null && local2 != null && local1.Length > 0 && local2.Length > 0)
{
this.x = System.Int32.Parse(local1);
this.y = System.Int32.Parse(local2);
// this.Page.RegisterRequiresRaiseEvent(this);
}
return false;
}
void System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
{
}
void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
{
if (this.CausesValidation)
this.Page.Validate();
this.OnClick(new ImageClickEventArgs(this.x, this.y));
this.OnCommand(new CommandEventArgs(this.CommandName, this.CommandArgument));
}
public bool CausesValidation
{
get
{
object local0;
local0 = this.ViewState["CausesValidation"];
if (local0 != null)
return (bool) local0;
return true;
}
set
{
this.ViewState["CausesValidation"] = value;
}
}
public string CommandArgument
{
get
{
string local0;
local0 = (String) this.ViewState["CommandArgument"];
if (local0 != null)
return local0;
return System.String.Empty;
}
set
{
this.ViewState["CommandArgument"] = value;
}
}
public string CommandName
{
get
{
string local0;
local0 = (String) this.ViewState["CommandName"];
if (local0 != null)
return local0;
return System.String.Empty;
}
set
{
this.ViewState["CommandName"] = value;
}
}
protected override System.Web.UI.HtmlTextWriterTag TagKey
{
get
{
return System.Web.UI.HtmlTextWriterTag.Input;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -