Environment.GetEntityUnderMouseCursor Method
Parameters
- mousePos
- Point
Mouse position in screen coordinates
- selectableOnly
- bool
When true, checks the Entity.Selectable property, otherwise no.
Return Value
intThe index of the entity, -1 otherwise.
The sensitivity is affected by the PickBoxSize parameter.
The following code fragment demonstrate how to highlight the entity under the mouse
cursor.
private void viewportProfessional1_MouseMove( object sender, MouseEventArgs e) { viewportProfessional1.ClearSelection(); int id = viewportProfessional1.GetEntityUnderMouseCursor(e.Location); if (id != -1) { Entity ent = viewportProfessional1.Entities[id] as Entity; ent.Selected = true; } viewportProfessional1.Invalidate(); }
This language is not supported or no code example is available.
Private Sub ViewportProfessional1_Move( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles ViewportProfessional1.Move ViewportProfessional1.ClearSelection() Dim id As Integer = ViewportProfessional1.GetEntityUnderMouseCursor( _ e.Location) If id <> -1 Then Dim ent As Entity = ViewportProfessional1.Entities(id) ent.Selected = True End If ViewportProfessional1.Invalidate() End Sub
This language is not supported or no code example is available.