home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmToolbox
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "Tools"
- ClientHeight = 375
- ClientLeft = 4650
- ClientTop = 1815
- ClientWidth = 810
- Height = 780
- Left = 4590
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 25
- ScaleMode = 3 'Pixel
- ScaleWidth = 54
- Top = 1470
- Width = 930
- Begin PictureBox PicClip1
- Height = 480
- Left = 0
- ScaleHeight = 450
- ScaleWidth = 1170
- TabIndex = 0
- Top = 0
- Width = 1200
- End
- Begin PictureBox SubClass1
- Height = 480
- Left = 12
- ScaleHeight = 450
- ScaleWidth = 1170
- TabIndex = 1
- Top = 104
- Width = 1200
- End
- Begin Image Image1
- Height = 330
- Index = 15
- Left = 0
- Top = 900
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 14
- Left = 1440
- Top = 600
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 13
- Left = 1080
- Top = 600
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 12
- Left = 720
- Top = 600
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 11
- Left = 360
- Top = 600
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 10
- Left = 0
- Top = 600
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 9
- Left = 1440
- Top = 300
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 8
- Left = 1080
- Top = 300
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 7
- Left = 720
- Top = 300
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 6
- Left = 360
- Top = 300
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 5
- Left = 0
- Top = 300
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 4
- Left = 1440
- Top = 0
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 3
- Left = 1080
- Top = 0
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 2
- Left = 720
- Top = 0
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 1
- Left = 360
- Top = 0
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 0
- Left = 0
- Top = 0
- Width = 360
- End
- Option Explicit
- Sub Form_Unload (Cancel As Integer)
- Unload frmFlyout
- frmToolbox!SubClass1.HwndParam = 0
- MDIForm1!Panel.Caption = ""
- End Sub
- Sub Image1_MouseDown (Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
- Dim last_tool% ' Index of the previously selected tool.
- Dim temp% ' Temp var
- ' The only thing we're interested in is the left mouse button.
- If (Button = LEFT_BUTTON) Then
-
- '
- ' Save, in the Toolbox structure, which icon in the toolbox was clicked on.
- '
- last_tool% = gToolbox.tool_selected
- gToolbox.tool_selected = Index
-
-
- '
- ' Change the selected tool's icon to the depressed version.
- '
- frmToolbox!Image1(Index).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(Index, 0).icon_index + ICON_DEPRESSED)
-
-
- '
- ' If needed, arrange the flyout menu.
- '
- If (last_tool% <> gToolbox.tool_selected) Then Call ArrangeFlyout
- '
- ' Set the form to be sub-classed (enables sub-classing)
- ' Show the flyout as modal.
- '
- frmFlyout!SubClass1.HwndParam = frmFlyout.hWnd
- temp% = SetCapture%(frmFlyout.hWnd)
- frmFlyout.Show MODELESS
- End If
- End Sub
- Sub SubClass1_WndMessage (wnd As Integer, msg As Integer, wp As Integer, lp As Long, retval As Long, nodef As Integer)
- Dim x% ' X coordinate of the mouse
- Dim y% ' Y coordinate of the mouse
- Dim row% ' Icon row the mouse is over
- Dim column% ' Icon column the mouse is over
- Dim image_num% ' The index of the icon the mouse is over
- ' Based on the API message received...
- Select Case (msg)
- '
- ' Our message that is received when the user selects something on the flyout.
- ' Index of flyout item selected is contained in the wp parameter.
- '
- Case WM_USER
-
- '
- ' Hide the flyout window.
- '
- frmFlyout.Hide
-
-
- '
- ' Save the item flyout item selected in the gToolbox structure.
- '
- gToolbox.flyout_item_selected = wp
-
-
- '
- ' Restore the icon for the selected tool to its normal state.
- '
- frmToolbox!Image1(gToolbox.tool_selected).Picture = frmToolbox!PicClip1.GraphicCell(gToolbox.icons(gToolbox.tool_selected, 0).icon_index)
-
-
- '
- ' Process the flyout menu selection.
- '
- Call ProcessFlyoutSelection
-
-
-
-
- '
- ' The user is moving the mouse in the toolbox window.
- ' Determine the tool the mouse is over and display the tool's help message.
- '
- Case WM_MOUSEMOVE
- '
- ' Extract the x and y mouse coordinates from the lp parameter.
- '
-
- Call dwDWORDto2Integers(lp, x%, y%)
-
-
- '
- ' Calculate the icon row and column the mouse is over.
- '
-
- column% = x% \ frmToolbox!Image1(0).Width
- row% = y% \ frmToolbox!Image1(0).Height
-
-
- '
- ' Determine the index of the icon the mouse is over.
- ' Display the tool's help string in the MDIForm1's status panel.
- '
-
- image_num% = (gToolbox.num_columns * row%) + column%
- MDIForm1!Panel.Caption = gToolbox.icons(image_num%, 0).help_str
-
-
- '
- ' The user has moved the toolbox window.
- ' Set the tool_selected field in the gToolbox structure to -1 so that
- ' if the user re-selects the last tool again, a call to ArrangeToolbox
- ' is forced. If this didn't happen, the flyout would be displayed in its
- ' old position, not where it should be.
- '
- Case WM_MOVE
- gToolbox.tool_selected = -1
-
- End Select
- End Sub
-