home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / design / toolba / toolbar.frm < prev    next >
Text File  |  1995-02-14  |  3KB  |  107 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Simple Toolbar"
  4.    ClientHeight    =   3870
  5.    ClientLeft      =   1155
  6.    ClientTop       =   1725
  7.    ClientWidth     =   7425
  8.    Height          =   4590
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3870
  12.    ScaleWidth      =   7425
  13.    Top             =   1080
  14.    Width           =   7575
  15.    Begin PictureBox PictBitmaps 
  16.       AutoRedraw      =   -1  'True
  17.       AutoSize        =   -1  'True
  18.       Height          =   1350
  19.       Left            =   90
  20.       Picture         =   TOOLBAR.FRX:0000
  21.       ScaleHeight     =   1320
  22.       ScaleWidth      =   3600
  23.       TabIndex        =   1
  24.       Top             =   540
  25.       Visible         =   0   'False
  26.       Width           =   3630
  27.    End
  28.    Begin PictureBox PictToolBar 
  29.       Align           =   1  'Align Top
  30.       AutoRedraw      =   -1  'True
  31.       BackColor       =   &H00C0C0C0&
  32.       Height          =   495
  33.       Left            =   0
  34.       ScaleHeight     =   465
  35.       ScaleWidth      =   7395
  36.       TabIndex        =   0
  37.       Top             =   0
  38.       Width           =   7425
  39.    End
  40.    Begin Menu MnuMain 
  41.       Caption         =   "&Toolbar"
  42.       Begin Menu MnuSub 
  43.          Caption         =   "&Add Button (Do it again)"
  44.          Index           =   1
  45.       End
  46.       Begin Menu MnuSub 
  47.          Caption         =   "&Remove Button 2"
  48.          Index           =   2
  49.       End
  50.       Begin Menu MnuSub 
  51.          Caption         =   "&Gray Button 3"
  52.          Index           =   3
  53.       End
  54.       Begin Menu MnuSub 
  55.          Caption         =   "-"
  56.          Index           =   98
  57.       End
  58.       Begin Menu MnuSub 
  59.          Caption         =   "&Exit"
  60.          Index           =   99
  61.       End
  62.    End
  63. End
  64. Option Explicit
  65. Dim ToolBarButtons() As ToolbarButtonType
  66.  
  67. Sub Form_Load ()
  68.    PictToolBar.ScaleMode = 3          ' Pixel
  69.    PictToolBar.ScaleHeight = 28       ' Hoehe der Toolbar
  70.    ReDim ToolBarButtons(0)
  71. End Sub
  72.  
  73. Sub MnuSub_Click (index As Integer)
  74.    On Error Resume Next
  75.    Select Case index
  76.    Case 1
  77.        Dim ToolBarsCount As Integer
  78.        ToolBarsCount = UBound(ToolBarButtons) + 1
  79.        ReDim Preserve ToolBarButtons(ToolBarsCount)
  80.        ToolbarAddButton PictToolBar, ToolBarButtons(ToolBarsCount), ToolBarsCount * 24, ToolBarsCount, PictBitmaps
  81.    Case 2
  82.        ToolBarHideButton PictToolBar, ToolBarButtons(2), PictBitmaps
  83.    Case 3
  84.        ToolBarGrayButton PictToolBar, ToolBarButtons(3), PictBitmaps
  85.    Case Else
  86.       Unload Me
  87.    End Select
  88. End Sub
  89.  
  90. Sub PictToolBar_Click ()
  91.    '
  92.    '
  93.    '
  94.    Dim ButtonNr As Integer
  95.    ButtonNr = ToolBarGetClicked(PictToolBar, ToolBarButtons())
  96.    If ButtonNr > 0 Then MsgBox "Hi, there was then " + Str(ButtonNr) + " Button Clicked)"
  97. End Sub
  98.  
  99. Sub PictToolBar_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
  100.     ToolBarMousedown PictToolBar, ToolBarButtons(), x, y, PictBitmaps
  101. End Sub
  102.  
  103. Sub PictToolBar_MouseUp (Button As Integer, Shift As Integer, x As Single, y As Single)
  104.    ToolBarMouseUp PictToolBar, ToolBarButtons(), x, y, PictBitmaps
  105. End Sub
  106.  
  107.