pexam12_8.frm

来自「深圳大学的vb上机与教学的课件」· FRM 代码 · 共 106 行

FRM
106
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5415
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   5415
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "画点"
      Height          =   375
      Left            =   4320
      TabIndex        =   4
      Top             =   2640
      Width           =   975
   End
   Begin VB.CommandButton Command4 
      Caption         =   "清屏幕"
      Height          =   375
      Left            =   2280
      TabIndex        =   3
      Top             =   2640
      Width           =   855
   End
   Begin VB.CommandButton Command3 
      Caption         =   "重载"
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   2640
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "关闭文件"
      Height          =   375
      Left            =   1080
      TabIndex        =   1
      Top             =   2640
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "打开文件"
      Height          =   375
      Left            =   0
      TabIndex        =   0
      Top             =   2640
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c As Long         '画点计数
Private Sub Command1_Click()
  Open "c:\test.img" For Binary As #1   '打开文件
End Sub

Private Sub Command2_Click()
  Close #1    '关闭文件
End Sub

Private Sub Command3_Click()
  Dim s As Long
  ScaleWidth = 100   ' 设置比例
  ScaleHeight = 100
  DrawWidth = 20
  For i = 1 To c
    Get #1, , m_x     '读文件
    Get #1, , m_y
    Get #1, , m_red
    Get #1, , m_green
    Get #1, , m_blue
    PSet (m_x, m_y), RGB(m_red, m_green, m_blue)  ' 画点
   Next
End Sub

Private Sub Command4_Click()
  Cls    '清屏幕
  Close #1
End Sub

Private Sub Command5_Click()
  c = c + 1          '画点计数
  ScaleWidth = 100   ' 设置比例
  ScaleHeight = 100
  DrawWidth = 20     ' 设置点的大小
  m_x = Rnd * 100    ' 设置随机点坐标(m_x,m_y)
  m_y = Rnd * 100
  m_red = Rnd * 255   ' 设置随机颜色
  m_green = Rnd * 255
  m_blue = Rnd * 255
  PSet (m_x, m_y), RGB(m_red, m_green, m_blue)  ' 画点
  Put #1, , m_x       '写入文件
  Put #1, , m_y
  Put #1, , m_red
  Put #1, , m_green
  Put #1, , m_blue
End Sub


⌨️ 快捷键说明

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