📄 htmlinputimage.cs
字号:
using System;
using System.Globalization;
using System.Collections.Specialized;
using System.Web.UI;
namespace System.Web.UI.HtmlControls
{
/// <summary>
/// Summary description for HtmlInputImage.
/// </summary>
//.custom instance void [System]System.ComponentModel.DefaultEventAttribute
public class HtmlInputImage : HtmlInputControl,IPostBackEventHandler,IPostBackDataHandler
{
private static object EventServerClick;
private int _x;
private int _y;
static HtmlInputImage()
{
HtmlInputImage.EventServerClick = new Object();
}
public HtmlInputImage() : base("image")
{
}
protected virtual void OnPreRender(EventArgs e)
{
if (this.Page != null)
{
if (!(this.Disabled))
this.Page.RegisterRequiresPostBack(this);
if (this.CausesValidation)
this.Page.RegisterPostBackScript();
}
}
protected virtual void OnServerClick(ImageClickEventArgs e)
{
ImageClickEventHandler local0;
local0 = (ImageClickEventHandler) this.Events[HtmlInputImage.EventServerClick];
if (local0 != null)
{
// local0.Invoke(this, e);
}
}
protected virtual void RenderAttributes(HtmlTextWriter writer)
{
this.PreProcessRelativeReferenceAttribute(writer, "src");
if (this.Page != null && this.CausesValidation)
{
if (this.CausesValidation)
{
// goto i-1;
}
// System.Web.UI.Util.WriteOnClickAttribute(this, 1, false, this.Page.Validators.Count > 0, false);
}
this.RenderAttributes(writer);
}
bool System.Web.UI.IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
{
string local0;
string local1;
local0 = postCollection[this.RenderedNameAttribute + ".x"];
local1 = postCollection[this.RenderedNameAttribute + ".y"];
if (local0 != null && local1 != null && local0.Length > 0 && local1.Length > 0)
{
this._x = System.Int32.Parse(local0, CultureInfo.InvariantCulture);
this._y = System.Int32.Parse(local1, CultureInfo.InvariantCulture);
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.OnServerClick(new ImageClickEventArgs(this._x, this._y));
}
public event ImageClickEventHandler ServerClick
{
add
{
this.Events.AddHandler(HtmlInputImage.EventServerClick, value);
}
remove
{
this.Events.RemoveHandler(HtmlInputImage.EventServerClick, value);
}
}
public string Align
{
get
{
string local0;
local0 = this.Attributes["align"];
if (local0 == null)
return "";
return local0;
}
set
{
this.Attributes["align"]= System.Web.UI.HtmlControls.HtmlControl.MapStringAttributeToString(value);
}
}
public string Alt
{
get
{
string local0;
local0 = this.Attributes["alt"];
if (local0 == null)
return "";
return local0;
}
set
{
this.Attributes["alt"]= System.Web.UI.HtmlControls.HtmlControl.MapStringAttributeToString(value);
}
}
public int Border
{
get
{
string local0;
local0 = this.Attributes["border"];
if (local0 == null)
return -1;
return System.Int32.Parse(local0, CultureInfo.InvariantCulture);
}
set
{
this.Attributes["border"]= System.Web.UI.HtmlControls.HtmlControl.MapIntegerAttributeToString(value);
}
}
public bool CausesValidation
{
get
{
object local0;
local0 = this.ViewState["CausesValidation"];
if (local0 != null)
return (Boolean) local0;
return true;
}
set
{
this.ViewState["CausesValidation"]= value;
}
}
public string Src
{
get
{
string local0;
local0 = this.Attributes["src"];
if (local0 == null)
return "";
return local0;
}
set
{
this.Attributes["src"]= System.Web.UI.HtmlControls.HtmlControl.MapStringAttributeToString(value);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -