⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmain.frm

📁 Visual Basic实现PC机与单片机串口通信任务 包含visual basic 和51的原代码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form frmain 
   AutoRedraw      =   -1  'True
   Caption         =   "仪表盘"
   ClientHeight    =   7920
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10440
   LinkTopic       =   "Form1"
   ScaleHeight     =   7920
   ScaleWidth      =   10440
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   3840
      TabIndex        =   15
      Top             =   480
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "关闭自动时钟"
      Height          =   375
      Left            =   120
      TabIndex        =   13
      Top             =   600
      Width           =   1335
   End
   Begin VB.CommandButton Command4 
      Caption         =   "打开自动时钟"
      Height          =   375
      Left            =   120
      TabIndex        =   12
      Top             =   120
      Width           =   1335
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   7680
      Top             =   5880
   End
   Begin VB.PictureBox biaoke 
      DragIcon        =   "frmain.frx":0000
      Height          =   3495
      Left            =   720
      ScaleHeight     =   60.59
      ScaleMode       =   6  'Millimeter
      ScaleWidth      =   90.223
      TabIndex        =   1
      Top             =   1200
      Width           =   5175
      Begin VB.CommandButton xianshiyincang 
         Caption         =   "……"
         Height          =   375
         Left            =   5640
         TabIndex        =   14
         Top             =   120
         Width           =   495
      End
      Begin VB.PictureBox biaopan 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         DrawWidth       =   2
         FillColor       =   &H000000C0&
         Height          =   2175
         Left            =   720
         Picture         =   "frmain.frx":0152
         ScaleHeight     =   37.306
         ScaleMode       =   6  'Millimeter
         ScaleWidth      =   60.59
         TabIndex        =   4
         Top             =   360
         Width           =   3495
         Begin VB.Line biaozhen 
            BorderColor     =   &H000000FF&
            Index           =   4
            X1              =   4.233
            X2              =   52.917
            Y1              =   35.983
            Y2              =   35.983
         End
         Begin VB.Label keduzhi 
            BackColor       =   &H80000009&
            Caption         =   "。"
            Height          =   135
            Index           =   6
            Left            =   0
            TabIndex        =   11
            Top             =   0
            Width           =   135
         End
         Begin VB.Label keduzhi 
            BackColor       =   &H80000009&
            Caption         =   "。"
            Height          =   135
            Index           =   5
            Left            =   0
            TabIndex        =   10
            Top             =   0
            Width           =   135
         End
         Begin VB.Label keduzhi 
            BackColor       =   &H80000009&
            Caption         =   "。"
            Height          =   135
            Index           =   4
            Left            =   0
            TabIndex        =   9
            Top             =   0
            Width           =   135
         End
         Begin VB.Label keduzhi 
            BackColor       =   &H80000009&
            Caption         =   "。"
            Height          =   135
            Index           =   3
            Left            =   0
            TabIndex        =   8
            Top             =   0
            Width           =   135
         End
         Begin VB.Label keduzhi 
            BackColor       =   &H80000009&
            Caption         =   "。"
            Height          =   135
            Index           =   2
            Left            =   0
            TabIndex        =   7
            Top             =   0
            Width           =   135
         End
         Begin VB.Label keduzhi 
            BackColor       =   &H80000009&
            Caption         =   "。"
            Height          =   135
            Index           =   1
            Left            =   0
            TabIndex        =   6
            Top             =   0
            Width           =   135
         End
         Begin VB.Label keduzhi 
            BackColor       =   &H80000009&
            Caption         =   "。"
            Height          =   135
            Index           =   0
            Left            =   0
            TabIndex        =   5
            Top             =   0
            Width           =   135
         End
         Begin VB.Line biaozhen 
            BorderColor     =   &H000000FF&
            Index           =   0
            X1              =   6.35
            X2              =   42.333
            Y1              =   33.867
            Y2              =   35.983
         End
         Begin VB.Line biaozhen 
            BorderColor     =   &H000000FF&
            Index           =   1
            X1              =   10.583
            X2              =   35.983
            Y1              =   35.983
            Y2              =   35.983
         End
         Begin VB.Line biaozhen 
            BorderColor     =   &H000000FF&
            Index           =   2
            X1              =   4.233
            X2              =   57.15
            Y1              =   35.983
            Y2              =   38.1
         End
         Begin VB.Line biaozhen 
            BorderColor     =   &H000000FF&
            Index           =   3
            X1              =   6.35
            X2              =   55.033
            Y1              =   35.983
            Y2              =   35.983
         End
      End
      Begin VB.TextBox celiangzhi 
         Height          =   390
         Left            =   2040
         TabIndex        =   3
         Top             =   3000
         Width           =   735
      End
      Begin VB.CommandButton canshu 
         Caption         =   "……"
         Height          =   375
         Left            =   0
         TabIndex        =   2
         Top             =   120
         Width           =   495
      End
   End
   Begin VB.CommandButton Command2 
      Caption         =   "关闭"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   1680
      TabIndex        =   0
      Top             =   120
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "外界输入参数"
      Height          =   375
      Left            =   2640
      TabIndex        =   16
      Top             =   480
      Width           =   1095
   End
End
Attribute VB_Name = "frmain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public biaopankuan As Single, biaopangao As Single, biaokekuan As Single, biaokegao As Single  '表盘,表壳外观尺寸
Public Kongjiankuan As Single, Kongjiangao As Single   '控件外形参数设定
Public Dian As Integer      '确定选中哪个点变量
Public Left1 As Single, Top1 As Single, Height1 As Single, Width1 As Single
Public xxx As Single        '测试用数值
Public KEdushulinshi As Integer    '判断是否再加载刻度标签变量
Public Kaiguanxiandian As Boolean   '设置显点于否
Public ShuBiao As Integer     '鼠标样子变量

Sub huadian()   '画出表壳周围的八个点
frmain.Cls
Line (biaoke.Left - 55, biaoke.Top - 55)-(biaoke.Left - 5, biaoke.Top - 5), vbBlue, BF  '画第一个点
Line (biaoke.Left - 55, biaoke.Top + biaoke.Height / 2)-(biaoke.Left - 5, biaoke.Top + biaoke.Height / 2 + 50), vbBlue, BF      '画第二个点
Line (biaoke.Left - 55, biaoke.Top + biaoke.Height + 5)-(biaoke.Left - 5, biaoke.Top + biaoke.Height + 55), vbBlue, BF  '画第三个点
Line (biaoke.Left + biaoke.Width / 2, biaoke.Top + biaoke.Height + 5)-(biaoke.Left + biaoke.Width / 2 + 50, biaoke.Top + biaoke.Height + 55), vbBlue, BF   '画第四个点
Line (biaoke.Left + biaoke.Width + 5, biaoke.Top + biaoke.Height + 5)-(biaoke.Left + biaoke.Width + 55, biaoke.Top + biaoke.Height + 55), vbBlue, BF
Line (biaoke.Left + biaoke.Width + 5, biaoke.Top + biaoke.Height / 2)-(biaoke.Left + biaoke.Width + 55, biaoke.Top + biaoke.Height / 2 + 50), vbBlue, BF
Line (biaoke.Left + biaoke.Width + 5, biaoke.Top - 55)-(biaoke.Left + biaoke.Width + 55, biaoke.Top - 5), vbBlue, BF
Line (biaoke.Left + biaoke.Width / 2, biaoke.Top - 55)-(biaoke.Left + biaoke.Width / 2 + 50, biaoke.Top - 10), vbBlue, BF

End Sub

Sub shezhibiaopan()
biaopan.Cls
biaokekuan = Zhizhen * 4  '参数按比例赋值
biaokegao = Zhizhen * 2.6
biaopankuan = Zhizhen * 3.2
biaopangao = Zhizhen * 1.8
biaopan.Left = Zhizhen * 0.4   '初始化表盘位置
biaopan.Top = Zhizhen * 0.2
biaopan.Width = biaopankuan
biaopan.Height = biaopangao
biaoke.Width = biaokekuan * ZH
biaoke.Height = biaokegao * ZH

canshu.Width = Zhizhen * 0.3  '设置参数设置按钮的大小和位置
canshu.Height = Zhizhen * 0.3
canshu.Left = 0
canshu.Top = 0
xianshiyincang.Width = Zhizhen * 0.3
xianshiyincang.Height = Zhizhen * 0.3
xianshiyincang.Left = biaoke.Width / ZH - xianshiyincang.Width
xianshiyincang.Top = 0
celiangzhi.Width = Zhizhen * 0.6    '设置读数框的大小和位置
celiangzhi.Height = Zhizhen * 0.2

celiangzhi.Left = (biaoke.ScaleWidth - celiangzhi.Width) / 2
celiangzhi.Top = Zhizhen * 21 / 10

biaopan.Scale (-Zhizhen * 1.6, Zhizhen * 1.5)-(Zhizhen * 1.6, -Zhizhen * 0.3)   '选表盘中心为坐标原点,建立坐标系

biaopan.Circle (0, 0), Zhizhen, , 0, PI   '画表盘半周

For i = 0 To Zhukedushu * Fenkedushu     '画刻度线

⌨️ 快捷键说明

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