frmmain.frm

来自「非常漂亮的VB控件」· FRM 代码 · 共 747 行 · 第 1/2 页

FRM
747
字号
      Begin 界面设计.Bd Bd2 
         Height          =   390
         Left            =   0
         TabIndex        =   16
         Top             =   0
         Width           =   1035
         _ExtentX        =   1826
         _ExtentY        =   688
         Picture         =   "FrmMain.frx":D2A8
         Caption         =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Picture         =   "FrmMain.frx":EAFE
         Begin VB.Image BC 
            Height          =   240
            Left            =   75
            Picture         =   "FrmMain.frx":10354
            Top             =   75
            Width           =   240
         End
         Begin VB.Image BA 
            Height          =   240
            Left            =   360
            Picture         =   "FrmMain.frx":10696
            Top             =   75
            Width           =   240
         End
         Begin VB.Image Bi 
            Height          =   240
            Left            =   630
            Picture         =   "FrmMain.frx":109D8
            Top             =   75
            Width           =   240
         End
      End
      Begin VB.Label Cap 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "华盛软件工作室-界面设计"
         Height          =   180
         Left            =   1065
         TabIndex        =   17
         Top             =   105
         Width           =   2070
      End
   End
   Begin VB.PictureBox Mnu 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   300
      Left            =   0
      ScaleHeight     =   20
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   541
      TabIndex        =   19
      Top             =   390
      Width           =   8115
      Begin VB.Label Mnu1 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "文件(&F)"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   120
         TabIndex        =   23
         Top             =   45
         Width           =   630
      End
      Begin VB.Label Mnu2 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "编辑(&E)"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   915
         TabIndex        =   22
         Top             =   45
         Width           =   630
      End
      Begin VB.Label Mnu4 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "帮助(&H)"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   2490
         TabIndex        =   21
         Top             =   45
         Width           =   630
      End
      Begin VB.Label Mnu3 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "格式(&O)"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   1695
         TabIndex        =   20
         Top             =   45
         Width           =   630
      End
   End
   Begin VB.Menu MnuFile 
      Caption         =   "文件(&F)"
      Visible         =   0   'False
      Begin VB.Menu MnuNew 
         Caption         =   "新建(&N)"
         Shortcut        =   ^N
      End
      Begin VB.Menu l0122 
         Caption         =   "-"
      End
      Begin VB.Menu MnuOpen 
         Caption         =   "打开(&O)..."
         Shortcut        =   ^O
      End
      Begin VB.Menu l1245 
         Caption         =   "-"
      End
      Begin VB.Menu MnuSave 
         Caption         =   "保存(&S)"
         Shortcut        =   ^S
      End
      Begin VB.Menu MnuSaveAs 
         Caption         =   "另存为(&A)..."
      End
      Begin VB.Menu l125 
         Caption         =   "-"
      End
      Begin VB.Menu MnuExit 
         Caption         =   "退出(&X)"
      End
   End
   Begin VB.Menu MnuEdit 
      Caption         =   "编辑(&E)"
      Visible         =   0   'False
      Begin VB.Menu MnuUndo 
         Caption         =   "撤消(&Z)"
         Shortcut        =   ^Z
      End
      Begin VB.Menu l90980 
         Caption         =   "-"
      End
      Begin VB.Menu MnuCut 
         Caption         =   "剪切(&X)"
         Shortcut        =   ^X
      End
      Begin VB.Menu MnuCopy 
         Caption         =   "复制(&C)"
         Shortcut        =   ^C
      End
      Begin VB.Menu MnuPaste 
         Caption         =   "粘贴(&V)"
         Shortcut        =   ^V
      End
      Begin VB.Menu l12412 
         Caption         =   "-"
      End
      Begin VB.Menu MnuSelAll 
         Caption         =   "全选(&A)"
         Shortcut        =   ^A
      End
   End
   Begin VB.Menu MnuWindow 
      Caption         =   "格式(&O)"
      Visible         =   0   'False
      Begin VB.Menu MnuNewWidows 
         Caption         =   "字体(&F)..."
         Shortcut        =   ^T
      End
      Begin VB.Menu MnuColor 
         Caption         =   "颜色(&C)..."
      End
      Begin VB.Menu l1251 
         Caption         =   "-"
      End
      Begin VB.Menu Mnuduan 
         Caption         =   "段落(&P)..."
      End
   End
   Begin VB.Menu MnuHelp 
      Caption         =   "帮助(&H)"
      Visible         =   0   'False
      Begin VB.Menu MnuAbout 
         Caption         =   "关于(&A)..."
      End
      Begin VB.Menu l235 
         Caption         =   "-"
      End
      Begin VB.Menu MnuHelp1 
         Caption         =   "说明(&H)"
         Shortcut        =   {F1}
      End
   End
End
Attribute VB_Name = "Frmmain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

Public Sub DoTransparency(TheForm As Form, Rnd As Integer)
' TheForm:  The form you want to be rounded rectangle shape
    
    Dim TempRegions(6) As Long
    Dim FormWidthInPixels As Long
    Dim FormHeightInPixels As Long
    Dim a
    
' Convert the form's height and width from twips to pixels
    FormWidthInPixels = TheForm.Width / Screen.TwipsPerPixelX
    FormHeightInPixels = TheForm.Height / Screen.TwipsPerPixelY
    
' Make a rounded rectangle shaped region with the dimentions of the form
    a = CreateRoundRectRgn(0, 0, FormWidthInPixels, FormHeightInPixels, Rnd, Rnd)
    
' Set this region as the shape for "TheForm"
    a = SetWindowRgn(TheForm.hWnd, a, True)
End Sub


'----------------------------以下的是窗体控件代码------------------------------------------
Private Sub BA_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    BA.Picture = Ba2.Picture
End Sub
Private Sub BA_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    BA.Picture = ba1.Picture
End Sub
Private Sub BA_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    BA.Picture = ba0.Picture
    MaxFrm Me, Tr, Rc, Br
End Sub
Private Sub BC_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    BC.Picture = bc2.Picture
End Sub
Private Sub BC_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    BC.Picture = Bc1.Picture
End Sub
Private Sub BC_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Unload Me
End Sub
Private Sub Bd1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Drag_me Me
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Image1.Picture = bd8.Picture
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Image1.Picture = bd9.Picture
    Unload Me
End Sub
Private Sub Bd2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    BC.Picture = Bc0.Picture
    BA.Picture = ba0.Picture
    Bi.Picture = Bi0.Picture
End Sub
Private Sub Bi_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Bi.Picture = Bi2.Picture
End Sub

Private Sub Bi_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Bi.Picture = Bi1.Picture
End Sub

Private Sub Bi_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Bi.Picture = Bi0.Picture
    Me.WindowState = 1
End Sub

Private Sub Bd1_Click()
    MnuNo
End Sub

Private Sub Bd1_DblClick()
    MaxFrm Me, Tr, Rc, Br
End Sub


Private Sub Cap_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Drag_me Me
End Sub
'----------------------------以上的是窗体控件代码------------------------------------------


Private Sub Cap_Click()
MnuNo
End Sub

Private Sub Cap_DblClick()
MaxFrm Me, Tr, Rc, Br

End Sub


Private Sub Command1_Click()
Form1.Show 1, Me
End Sub

Private Sub Form_Click()
MnuNo
End Sub



Private Sub Form_Resize()
DoTransparency Me, 5
Mnu.Width = Me.Width
End Sub

Private Sub Mnu_Click()
MnuNo
End Sub

Private Sub Mnu1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MnuNo
Mnu1.BorderStyle = 1
PopupMenu MnuFile, , Mnu1.Left + Mnu.Left, Mnu1.Top + Mnu1.Height + Mnu.Top

End Sub

Private Sub Mnu2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MnuNo
Mnu2.BorderStyle = 1
PopupMenu MnuEdit, , Mnu2.Left + Mnu.Left, Mnu2.Top + Mnu2.Height + Mnu.Top
End Sub
Private Sub MnuNo()
Mnu2.BorderStyle = 0
Mnu1.BorderStyle = 0
Mnu3.BorderStyle = 0
Mnu4.BorderStyle = 0
End Sub

Private Sub Mnu3_Click()
MnuNo
Mnu3.BorderStyle = 1
PopupMenu MnuWindow, , Mnu3.Left + Mnu.Left, Mnu3.Top + Mnu3.Height + Mnu.Top

End Sub

Private Sub Mnu4_Click()
MnuNo
Mnu4.BorderStyle = 1
PopupMenu MnuHelp, , Mnu4.Left + Mnu.Left, Mnu4.Top + Mnu4.Height + Mnu.Top

End Sub

Private Sub MnuAbout_Click()
Form1.Show 1, Me
End Sub

Private Sub MnuExit_Click()
Unload Me
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?