windowsforms-devexpress-dot-xtraeditors-dot-svgimagebox-3881ff59.md
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
public event SvgImageItemMouseEventHandler ItemClick
Public Event ItemClick As SvgImageItemMouseEventHandler
The ItemClick event's data class is SvgImageItemMouseEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Button | Gets the pressed mouse button. |
| Handled | Gets or sets whether to manually process item clicks. |
| Item | Gets the currently processed item. Inherited from SvgImageItemEventArgs. |
| Location | Gets the mouse location relative to the control’s top left corner. |
| X | Gets the mouse x-coordinate relative to the control’s top left corner. |
| Y | Gets the mouse y-coordinate relative to the control’s top left corner. |
The following code sample changes the item’s color when a user right-clicks it. The second right-click returns the initial color:
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;
}
}
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