ImageClickEventArgs ImageClickEventArgs ImageClickEventArgs ImageClickEventArgs Class

Definition

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
Inheritance
ImageClickEventArgsImageClickEventArgsImageClickEventArgsImageClickEventArgs

Examples

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

Remarks

This class passes the location where a user clicked an HtmlInputImage server control or an ImageButton Web server control. Clicking 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.

Note

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.

Constructors

ImageClickEventArgs(Int32, Int32) ImageClickEventArgs(Int32, Int32) ImageClickEventArgs(Int32, Int32) ImageClickEventArgs(Int32, Int32)

Initializes a new instance of the ImageClickEventArgs class using the x and y parameters.

ImageClickEventArgs(Int32, Int32, Double, Double) ImageClickEventArgs(Int32, Int32, Double, Double) ImageClickEventArgs(Int32, Int32, Double, Double) ImageClickEventArgs(Int32, Int32, Double, Double)

Initializes a new instance of the ImageClickEventArgs class using the x, y, xRaw, and yRaw parameters.

Fields

X X X X

An integer that represents the x-coordinate where a user clicked an image-based ASP.NET server control.

XRaw XRaw XRaw XRaw

An integer that represents the raw x-coordinate where a user clicked an image-based ASP.NET server control.

Y Y Y Y

An integer that represents the y-coordinate where a user clicked an image-based ASP.NET server control.

YRaw YRaw YRaw YRaw

An integer that represents the raw y-coordinate where a user clicked an image-based ASP.NET server control.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also