Breyta

Deila með


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
ImageClickEventArgs

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, Double, Double)

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

ImageClickEventArgs(Int32, Int32)

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

Fields

X

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

XRaw

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

Y

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

YRaw

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

Methods

Equals(Object)

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

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also