ImageClickEventArgs 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为用户单击基于图像的 ASP.NET 服务器控件(如 HtmlInputImage 或 ImageButton 服务器控件)时发生的任何事件提供数据。 此类不能被继承。
public ref class ImageClickEventArgs sealed : EventArgs
public sealed class ImageClickEventArgs : EventArgs
type ImageClickEventArgs = class
inherit EventArgs
Public NotInheritable Class ImageClickEventArgs
Inherits EventArgs
- 继承
示例
下面的代码示例演示了一个 ASP.NET 页,该页使用此类提供的信息来显示用户单击图像的坐标。
// 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 服务器控件的位置。 HtmlInputImage单击服务器控件会导致ServerClick事件发生,同时单击ImageButton服务器控件会导致Click事件发生。 然后,可以使用事件处理程序根据这些坐标的值以编程方式响应事件。
注释
原点坐标 (0,0) 位于图像的左上角。
引发事件会通过委托调用事件处理程序。 有关详细信息,请参阅 处理和引发事件。
构造函数
| 名称 | 说明 |
|---|---|
| ImageClickEventArgs(Int32, Int32, Double, Double) |
使用 |
| ImageClickEventArgs(Int32, Int32) |
使用ImageClickEventArgs和 |
字段
| 名称 | 说明 |
|---|---|
| X |
一个整数,表示用户单击基于图像 ASP.NET 服务器控件的 x 坐标。 |
| XRaw |
一个整数,表示用户单击基于图像 ASP.NET 服务器控件的原始 x 坐标。 |
| Y |
一个整数,表示用户单击基于图像 ASP.NET 服务器控件的 y 坐标。 |
| YRaw |
一个整数,表示用户单击基于图像 ASP.NET 服务器控件的原始 y 坐标。 |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |