ImageClickEventArgs 类

定义

为用户在单击基于图像的 ASP.NET 服务器控件(如 HtmlInputImageImageButton 服务器控件)时所发生的任何事件提供数据。Provides data for any events that occur when a user clicks an image-based ASP.NET server control, such as the HtmlInputImage or ImageButton server controls. 此类不能被继承。This class cannot be inherited.

public ref class ImageClickEventArgs sealed : EventArgs
public sealed class ImageClickEventArgs : EventArgs
type ImageClickEventArgs = class
    inherit EventArgs
Public NotInheritable Class ImageClickEventArgs
Inherits EventArgs
继承
ImageClickEventArgs

示例

下面的代码示例演示一个 ASP.NET 页, 该页使用此类提供的信息显示用户在图像上单击的坐标。The following code example demonstrates an ASP.NET page that uses the information provided by this class to display the coordinates of a user's click on an image.

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

注解

此类传递用户单击HtmlInputImage服务器控件ImageButton或 Web 服务器控件的位置。This class passes the location where a user clicked an HtmlInputImage server control or an ImageButton Web server control. 单击服务器控件将ServerClick导致事件ImageButton发生, 而单击服务器控件将导致Click事件发生。 HtmlInputImageClicking an HtmlInputImage server control causes a ServerClick event to occur, while clicking an ImageButton server control causes a Click event to occur. 然后, 可以使用事件处理程序根据这些坐标的值以编程方式响应事件。You can then use event handlers to programmatically respond to the event based on the value of these coordinates.

备注

源坐标 (0, 0) 位于图像的左上角。The origin coordinates (0,0) are located at the upper left corner of the image.

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息, 请参阅处理和引发事件For more information, see Handling and Raising Events.

构造函数

ImageClickEventArgs(Int32, Int32)

使用 xy 参数初始化 ImageClickEventArgs 类的新实例。Initializes a new instance of the ImageClickEventArgs class using the x and y parameters.

ImageClickEventArgs(Int32, Int32, Double, Double)

初始化使用 x, yxRaw,和 yRaw 参数的 ImageClickEventArgs 类的新实例。Initializes a new instance of the ImageClickEventArgs class using the x, y, xRaw, and yRaw parameters.

字段

X

一个整数,表示用户在基于图像的 ASP.NET 服务器控件上单击的位置的 X 坐标。An integer that represents the x-coordinate where a user clicked an image-based ASP.NET server control.

XRaw

一个整数,表示用户在基于图像的 ASP.NET 服务器控件上单击的位置的原始 X 坐标。An integer that represents the raw x-coordinate where a user clicked an image-based ASP.NET server control.

Y

一个整数,表示用户在基于图像的 ASP.NET 服务器控件上单击的位置的 Y 坐标。An integer that represents the y-coordinate where a user clicked an image-based ASP.NET server control.

YRaw

一个整数,表示用户在基于图像的 ASP.NET 服务器控件上单击的位置的原始 Y 坐标。An integer that represents the raw y-coordinate where a user clicked an image-based ASP.NET server control.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅