Eyeshot 11 WinForms API Reference
WinForms Assembly / devDept.Eyeshot Namespace / ViewportLayout Class / GetEntityUnderMouseCursor Method
Mouse position in screen coordinates
When true, checks the devDept.Eyeshot.Entities.Entity.Selectable property, otherwise no.
Example

In This Topic
    GetEntityUnderMouseCursor Method
    In This Topic
    Returns the index of the first top level entity under the mouse cursor.
    Syntax
    'Declaration
     
    Public Function GetEntityUnderMouseCursor( _
       ByVal mousePos As Point, _
       Optional ByVal selectableOnly As Boolean _
    ) As Integer
    public int GetEntityUnderMouseCursor( 
       Point mousePos,
       bool selectableOnly
    )

    Parameters

    mousePos
    Mouse position in screen coordinates
    selectableOnly
    When true, checks the devDept.Eyeshot.Entities.Entity.Selectable property, otherwise no.

    Return Value

    The index of the entity, -1 otherwise.
    Remarks
    The sensitivity is affected by the PickBoxSize parameter.
    Example
    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();
     
    }
    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
    See Also