ImageClickEventHandler 委托

定义

表示处理在用户单击基于图像的 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)

参数

sender
Object

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

e
ImageClickEventArgs

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

继承
ImageClickEventHandler

示例

// 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

注解

此委托为用户单击基于图像的 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. 对于OnServerClick OnClick为服务器控件创建的任何事件处理程序或为ImageButton Web 服务器控件创建的任何事件处理程序, 都必须使用此委托定义的签名。 HtmlInputImageYou 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.

扩展方法

GetMethodInfo(Delegate)

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

适用于

另请参阅