VERSION 5.00
Begin VB.Form Form1 
Caption ="Form1"
ClientHeight=4770
ClientLeft =165
ClientTop=735
ClientWidth =6405
BeginProperty Font 
Name="Comic Sans MS"
Size=8.25
Charset =0
Weight =400
Underline=0'False
Italic =0'False
Strikethrough=0'False
EndProperty
LinkTopic="Form1"
ScaleHeight =4770
ScaleWidth =6405
StartUpPosition =3 'Windows Default
Begin VB.Menu mnuView 
Caption ="View"
Begin VB.Menu mnuViewTB 
Caption ="Show Toolbar"
Checked =-1 'True
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
    frmToolbar.Show
End Sub
Private Sub Form_Paint()
    DockToolbar frmToolbar, DockSetting, Form1
    End Sub
Private Sub Form_Resize()
    DockToolbar frmToolbar, DockSetting, Form1
    End Sub
Private Sub Form_Unload(Cancel As Integer)
    Unload frmToolbar
End Sub
Private Sub mnuViewTB_Click()
    If mnuViewTB.Checked = False Then
        frmToolbar.Show
        mnuViewTB.Checked = True
        Form1.SetFocus
        ElseIf mnuViewTB.Checked = True Then
            frmToolbar.Hide
            mnuViewTB.Checked = False
        End If
    End Sub

解决方案 »

  1.   

    VERSION 5.00
    Begin VB.Form frmToolbar 
    AutoRedraw =-1 'True
    BorderStyle =5 'Sizable ToolWindow
    ClientHeight=2730
    ClientLeft =60
    ClientTop=60
    ClientWidth =1110
    ControlBox =0'False
    LinkTopic="Form2"
    MaxButton=0'False
    MinButton=0'False
    ScaleHeight =2730
    ScaleWidth =1110
    ShowInTaskbar=0'False
    StartUpPosition =3 'Windows Default
    Visible =0'False
    WhatsThisHelp=-1 'True
    Begin VB.CommandButton Command1 
    BackColor=&H00C0C0C0&
    Caption ="X"
    Height =210
    Left=855
    TabIndex=1
    Top =15
    UseMaskColor=-1 'True
    Width=210
    End
    Begin VB.Label Label1 
    BackColor=&H80000002&
    Caption ="Toolbar"ForeColor=&H80000009&
    Height =255
    Left=0
    TabIndex=0
    Top =0
    Width=1095
    End
    Begin VB.Menu mnuTB 
    Caption ="Toolbar"
    Visible =0'False
    Begin VB.Menu mnuTBDock 
    Caption ="Dock Left"
    Index=1
    End
    Begin VB.Menu mnuTBDock 
    Caption ="Dock Right"
    Checked =-1 'True
    Index=2
    End
    Begin VB.Menu mnuTBDock 
    Caption ="Dock Top"
    Index=3
    End
    Begin VB.Menu mnuTBDock 
    Caption ="Dock Bottom"
    Index=4
    End
    Begin VB.Menu mnuTBDock 
    Caption ="Dock None"
    Index=5
    End
    End
    End
    Attribute VB_Name = "frmToolbar"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = FalsePrivate Sub Command1_Click()
        Unload frmToolbar
        Form1!mnuViewTB.Checked = False
        End SubPrivate Sub Form_Initialize()    DockSetting = DK_RIGHT
            DockOption = DK_RIGHT
            End SubPrivate Sub Form_Load()
        SetWindowLong frmToolbar.hwnd, GWL_HWNDPARENT, Form1.hwnd
        DockSetting = DK_RIGHT
            DockOption = DK_RIGHT
                DockToolbar frmToolbar, DockSetting, Form1
                End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = 2 Then
            PopupMenu mnuTB
        End If
        Form1.SetFocus
        End SubPrivate Sub Form_Resize()
        Label1.Width = frmToolbar.Width
        Command1.Left = Label1.Left + Label1.Width - 340
        If frmToolbar.Height > Form1.Height - 420 Then
            frmToolbar.Height = Form1.Height - 420
            Form1.SetFocus
            End If
            If frmToolbar.Width < 1095 Then
                frmToolbar.Width = 1095
                If frmToolbar.Left + frmToolbar.Width > Form1.Left + Form1.Width Then frmToolbar.Left = Form1.Left + Form1.Width - frmToolbar.Left - 60
                Form1.SetFocus
                End If
                If frmToolbar.Height < 360 Then
                    frmToolbar.Top = Form1.Top + 360
                    frmToolbar.Height = 360
                    Form1.SetFocus
                    End If
                    If frmToolbar.Left < Form1.Left Then
                        frmToolbar.Left = frmToolbar.Left + 60
                        Form1.SetFocus
                        End If
                        DockToolbar frmToolbar, DockSetting, Form1
                        End SubPrivate Sub mnuTBDock_Click(Index As Integer)
        mnuTBDock(DockOption).Checked = False
        mnuTBDock(Index).Checked = True
        DockSetting = Index
            DockOption = DockSetting
                DockToolbar frmToolbar, DockSetting, Form1
                    Form1.SetFocus
                    End SubPrivate Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = 1 Then
            mnuTBDock(DockOption).Checked = False
            DockSetting = DK_NONE
                DockOption = DK_NONE
                    mnuTBDock(DockSetting).Checked = True
                    DockToolbar frmToolbar, DockSetting, Form1
                        BeginFRDrag X, Y
                    End If
                    Form1.SetFocus
                    End SubPrivate Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button > 0 Then
            DoFRDrag X, Y
            End If
            Form1.SetFocus
            End Sub
    Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Select Case Button
            Case vbLeftButton
            EndFRDrag X, Y
            Case vbRightButton
            PopupMenu mnuTB
        End Select
    frmToolbar.Refresh
    Command1.Refresh
    Label1.Refresh
    Form1.SetFocus
    End Sub
    Private Sub mnuDocked_Click()
        mnuDocked.Checked = Not mnuDocked.Checked
        Select Case mnuDocked.Checked
            Case vbChecked
            Case vbUnchecked
            Me.Width = InitialWidth
            Me.Height = InitialHeight
        End Select
    Form1.SetFocus
    End Sub
      

  2.   

    回复人: zyl910(910:分儿,我来了!) (  ) 信誉:110  2002-3-7  20:00:22  得分:0  
     
     
      *.vbp? 
    自己随便生成一个不行吗?
      

  3.   

    按 VB 默认的建 VBP 再把 Form 加进
      

  4.   

    我觉得有个vbp会比较方便!Type=Exe
    Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\WINDOWS\SYSTEM\stdole2.tlb#OLE Automation
    Form=form1.frm
    Form=frmToolBar.frm
    Module=Module1; Module1.bas
    Startup="Form1"
    HelpFile=""
    Command32=""
    Name="Docking"
    HelpContextID="0"
    CompatibleMode="0"
    MajorVer=1
    MinorVer=0
    RevisionVer=0
    AutoIncrementVer=0
    ServerSupportFiles=0
    VersionCompanyName="91"
    CompilationType=0
    OptimizationType=0
    FavorPentiumPro(tm)=0
    CodeViewDebugInfo=0
    NoAliasing=0
    BoundsCheck=0
    OverflowCheck=0
    FlPointCheck=0
    FDIVCheck=0
    UnroundedFP=0
    StartMode=0
    Unattended=0
    Retained=0
    ThreadPerObject=0
    MaxNumberOfThreads=1