Back to Devexpress

SvgImageBox.ItemClick Event

windowsforms-devexpress-dot-xtraeditors-dot-svgimagebox-3881ff59.md

latest3.3 KB
Original Source

SvgImageBox.ItemClick Event

Occurs when a user clicks an SvgImageItem in the SvgImageBox.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
public event SvgImageItemMouseEventHandler ItemClick
vb
Public Event ItemClick As SvgImageItemMouseEventHandler

Event Data

The ItemClick event's data class is SvgImageItemMouseEventArgs. The following properties provide information specific to this event:

PropertyDescription
ButtonGets the pressed mouse button.
HandledGets or sets whether to manually process item clicks.
ItemGets the currently processed item. Inherited from SvgImageItemEventArgs.
LocationGets the mouse location relative to the control’s top left corner.
XGets the mouse x-coordinate relative to the control’s top left corner.
YGets the mouse y-coordinate relative to the control’s top left corner.

Remarks

The following code sample changes the item’s color when a user right-clicks it. The second right-click returns the initial color:

csharp
void OnItemClick(object sender, DevExpress.XtraEditors.SvgImageItemMouseEventArgs e) {
    var fillColor = Color.Green;
    if (e.Button == MouseButtons.Right) {
        if (e.Item.Appearance.Normal.FillColor == fillColor)
            e.Item.Appearance.Normal.Reset();
        else
            e.Item.Appearance.Normal.FillColor = fillColor;
    }
}
vb
Private Sub OnItemClick(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.SvgImageItemMouseEventArgs)
    Dim fillColor = Color.Green
    If e.Button = MouseButtons.Right Then
        If e.Item.Appearance.Normal.FillColor = fillColor Then
            e.Item.Appearance.Normal.Reset()
        Else
            e.Item.Appearance.Normal.FillColor = fillColor
        End If
    End If
End Sub

See Also

SvgImageBox Class

SvgImageBox Members

DevExpress.XtraEditors Namespace