windowsforms-devexpress-dot-utils-dot-html-dot-dxhtmlpaintercontext-dot-onmousemove-x28-system-dot-windows-dot-forms-dot-mouseeventargs-system-dot-object-x29.md
Transfers the MouseMove mouse event to the target HTML element. This allows the element to change its visual state from “normal” to “hovered”.
Namespace : DevExpress.Utils.Html
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
public void OnMouseMove(
MouseEventArgs e,
object interactivityKey = null
)
Public Sub OnMouseMove(
e As MouseEventArgs,
interactivityKey As Object = Nothing
)
| Name | Type | Description |
|---|---|---|
| e | MouseEventArgs |
The EventArgs object utilized by the origin MouseMove event (the MouseMove event of the parent control).
|
| Name | Type | Default | Description |
|---|---|---|---|
| interactivityKey | Object | null |
The ID that allows you to identify the specific instance of a custom-drawn template.
|
The code below illustrates how to paint instances of the same HTML template inside Data Grid row preview areas, and assign unique IDs to all of these instances. The control’s MouseMove event is handled to identify the specific template instance of a template, and transmit this mouse event to this instance.
DxHtmlPainterContext ctx = new DxHtmlPainterContext();
gridView.CustomDrawRowPreview += (s, e) => {
// Use a data source row index as a template instance ID
int index = (s as GridView).GetDataSourceRowIndex(e.RowHandle);
e.DrawHtml(htmlTemplate, ctx, (args) => args.InteractivityKey = index);
e.Handled = true;
};
gridView.MouseMove += (s, e) => {
GridView view = s as GridView;
GridHitInfo hitInfo = view.CalcHitInfo(e.Location);
if(hitInfo.RowHandle >= 0) {
int index = view.GetDataSourceRowIndex(hitInfo.RowHandle);
// Use the same interaction key value to find the correct template
ctx.OnMouseMove(e, index);
view.GridControl.Cursor = ctx.GetCursor(e.Location, index);
view.InvalidateRow(hitInfo.RowHandle);
}
};
Dim ctx As New DxHtmlPainterContext()
AddHandler gridView.CustomDrawRowPreview, Sub(s, e)
' Use a data source row index as a template instance ID
Dim index As Integer = (TryCast(s, GridView)).GetDataSourceRowIndex(e.RowHandle)
e.DrawHtml(htmlTemplate, ctx, Sub(args) args.InteractivityKey = index)
e.Handled = True
End Sub
AddHandler gridView.MouseMove, Sub(s, e)
Dim view As GridView = TryCast(s, GridView)
Dim hitInfo As GridHitInfo = view.CalcHitInfo(e.Location)
If hitInfo.RowHandle >= 0 Then
Dim index As Integer = view.GetDataSourceRowIndex(hitInfo.RowHandle)
' Use the same interaction key value to find the correct template
ctx.OnMouseMove(e, index)
view.GridControl.Cursor = ctx.GetCursor(e.Location, index)
view.InvalidateRow(hitInfo.RowHandle)
End If
End Sub
See this article to learn more about transmitting mouse events from parent controls to HTML template instances: Custom Draw Templates.
See Also