ImageClickEventHandler Delegate

Definition

表示处理在用户单击基于图像的 ASP.NET 服务器控件时引发的所有事件的方法。Represents the method that handles any events that are raised when a user clicks an image-based ASP.NET server control.

public delegate void ImageClickEventHandler(System::Object ^ sender, ImageClickEventArgs ^ e);
public delegate void ImageClickEventHandler(object sender, ImageClickEventArgs e);
type ImageClickEventHandler = delegate of obj * ImageClickEventArgs -> unit
Public Delegate Sub ImageClickEventHandler(sender As Object, e As ImageClickEventArgs)

Parameters

sender
Object

作为事件源的服务器控件。The server control that is the source of the event.

e
ImageClickEventArgs

包含事件数据的 ImageClickEventArgsAn ImageClickEventArgs that contains event data.

Inheritance
ImageClickEventHandler

Examples

// Define the event handler that uses coordinate information through ImageClickEventArgs.
void ImageButton_Click(object sender, ImageClickEventArgs e) 
{
   Label1.Text = "You clicked the ImageButton control at the coordinates: (" + 
                 e.X.ToString() + ", " + e.Y.ToString() + ")";
}
' Define the event handler that uses coordinate information through ImageClickEventArgs.
Sub ImageButton_Click(sender As Object, e As ImageClickEventArgs) 
   Label1.Text = "You clicked the ImageButton control at the coordinates: (" & _ 
                 e.X.ToString() & ", " & e.Y.ToString() & ")"
End Sub

Remarks

此委托为用户单击基于图像的 ASP.NET 服务器控件时引发的所有 click 事件定义所需的签名。This delegate defines the required signature for all click events raised when a user clicks an image-based ASP.NET server control. 对于为 HtmlInputImage 服务器控件创建的任何 OnServerClick 事件处理程序或为 ImageButton Web 服务器控件创建的任何 OnClick 事件处理程序,必须使用此委托定义的签名。You must use the signature defined by this delegate for any OnServerClick event handlers that you create for an HtmlInputImage server control or any OnClick event handlers that you create for an ImageButton Web server control.

如果创建用户可单击的基于映像的自定义 ASP.NET 服务器控件,请使用此委托来定义与该用户操作关联的事件。If you create a custom image-based ASP.NET server control that users can click, use this delegate to define the events associated with that user action.

有关委托以及它们如何与事件交互的详细信息,请参阅处理和引发事件For more information about delegates and how they interact with events, see Handling and Raising Events. 有关如何引发事件的信息,请参阅处理和引发事件For information about how to raise events, see Handling and Raising Events.

Extension Methods

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

Applies to

See also