Вы можете получить код для работы в полноэкранном режиме. В примере ниже я подключил событие MouseMove к приложению. Он делает контур фигуры, которую вы стали более толстой, когда мышь находится над этой фигурой.
Вы можете протестировать код, нарисовав на странице несколько прямоугольников, а затем перемещая мышь в полноэкранном режиме.
Однако мне не удалось перехватить MouseDown в полноэкранном режиме.
Больше примечаний в комментариях к коду!
Option Explicit
'// Notes:
'//
'// - This code works in full screen mode!
'// - The mouse-up code doesn't work if you drag the shape,
'// (which won't be an issue in full-screen mode!)
Dim WithEvents m_visApp As Visio.Application
Private m_visShpMouseDown As Visio.Shape
Private m_lineWeightFormulaU As String
Private Sub Document_RunModeEntered(ByVal doc As IVDocument)
'// Toggle RunMode on and off via the blue triangle button just
'// right of the Stop/Reset button. This lets you reset the
'// code without closing and opening the file every time! Also,
'// this proc runs when you open the file, so m_visApp will
'// be set up to receive events!
Set m_visApp = Visio.Application
End Sub
Private Sub m_visApp_MouseMove(ByVal Button As Long, ByVal KeyButtonState As Long, ByVal x As Double, ByVal y As Double, CancelDefault As Boolean)
Dim pg As Visio.Page
Set pg = m_visApp.ActivePage
If (pg Is Nothing) Then GoTo Cleanup
Dim shp As Visio.Shape
For Each shp In pg.Shapes
If (shp.HitTest(x, y, 0)) Then
'// The mouse is over a shape.
If (shp Is m_visShpMouseDown) Then
Debug.Print "MouseMove over same shape! " & DateTime.Now
GoTo Cleanup
Else
Debug.Print "MouseMove over shape! " & DateTime.Now
'// Restore any previously mouse-overed shape:
Call m_restoreShape
'// Save the original lineweight and change it to
'// something thicker:
m_lineWeightFormulaU = shp.CellsU("LineWeight").FormulaU
Set m_visShpMouseDown = shp
'// Make the lineweight thick:
shp.CellsU("LineWeight").FormulaForceU = "5pt"
GoTo Cleanup
'// Note: the above won't change the lineweights
'// for all shapes in a group. If you intend to use
'// this on grouped shapes, you'll have to recurse
'// into the group, which makes things a bit more
'// complicated!
End If
End If
Next shp
Call m_restoreShape
Cleanup:
Set shp = Nothing
Set pg = Nothing
End Sub
Private Sub m_restoreShape()
If (m_visShpMouseDown Is Nothing) Then Exit Sub
'// Restore the shape's original lineweight:
m_visShpMouseDown.CellsU("LineWeight").FormulaU = m_lineWeightFormulaU
'// Clear the mouse-down variables:
Set m_visShpMouseDown = Nothing
m_lineWeightFormulaU = vbNullString
End Sub