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

📄 formpicture.frm

📁 河北工业大学大一至大二学期
💻 FRM
字号:
VERSION 5.00
Begin VB.Form formPicture 
   Caption         =   "像素画"
   ClientHeight    =   3675
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4650
   LinkTopic       =   "Form1"
   ScaleHeight     =   3675
   ScaleWidth      =   4650
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Reset 
      Caption         =   "Reset"
      Height          =   375
      Left            =   3360
      TabIndex        =   13
      Top             =   3120
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "选取颜色"
      Height          =   2535
      Left            =   3360
      TabIndex        =   4
      Top             =   480
      Width           =   975
      Begin VB.Label lColor 
         BackColor       =   &H00FFFFFF&
         Height          =   255
         Index           =   7
         Left            =   360
         TabIndex        =   12
         Top             =   2040
         Width           =   255
      End
      Begin VB.Label lColor 
         BackColor       =   &H00FF00FF&
         Height          =   255
         Index           =   6
         Left            =   360
         TabIndex        =   11
         Top             =   1800
         Width           =   255
      End
      Begin VB.Label lColor 
         BackColor       =   &H00FFFF00&
         Height          =   255
         Index           =   5
         Left            =   360
         TabIndex        =   10
         Top             =   1560
         Width           =   255
      End
      Begin VB.Label lColor 
         BackColor       =   &H0000FFFF&
         Height          =   255
         Index           =   4
         Left            =   360
         TabIndex        =   9
         Top             =   1320
         Width           =   255
      End
      Begin VB.Label lColor 
         BackColor       =   &H00FF0000&
         Height          =   255
         Index           =   3
         Left            =   360
         TabIndex        =   8
         Top             =   1080
         Width           =   255
      End
      Begin VB.Label lColor 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   2
         Left            =   360
         TabIndex        =   7
         Top             =   840
         Width           =   255
      End
      Begin VB.Label lColor 
         BackColor       =   &H000000FF&
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   6
         Top             =   600
         Width           =   255
      End
      Begin VB.Label lColor 
         BackColor       =   &H00000000&
         Height          =   255
         Index           =   0
         Left            =   360
         TabIndex        =   5
         Top             =   360
         Width           =   255
      End
   End
   Begin VB.PictureBox contain 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   2550
      Left            =   360
      ScaleHeight     =   2550
      ScaleWidth      =   2550
      TabIndex        =   0
      Top             =   480
      Width           =   2550
      Begin VB.Label pnt 
         BackColor       =   &H00000000&
         ForeColor       =   &H000000FF&
         Height          =   255
         Index           =   0
         Left            =   0
         TabIndex        =   1
         Top             =   0
         Width           =   255
      End
   End
   Begin VB.Label CC 
      BackColor       =   &H00000000&
      Height          =   255
      Left            =   2040
      TabIndex        =   3
      Top             =   3240
      Width           =   255
   End
   Begin VB.Label Label1 
      Caption         =   "当前颜色:"
      Height          =   255
      Left            =   840
      TabIndex        =   2
      Top             =   3240
      Width           =   975
   End
End
Attribute VB_Name = "formPicture"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()     '动态加载控件组
Me.Show
Dim i As Long
For i = 1 To 99
    Load pnt(i)
    pnt(i).Visible = True
Next
For i = 0 To 99             '排列控件组的位置
    pnt(i).Left = (i \ 10) * 255
    pnt(i).Top = (i Mod 10) * 255
Next
End Sub

Private Sub lColor_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    CC.BackColor = lColor(Index).BackColor  '设置当前颜色
End Sub

Private Sub pnt_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then           '当鼠标左键按下时绘制像素
    pnt(Index).BackColor = CC.BackColor
End If
End Sub

Private Sub Reset_Click()
Dim i As Long               '还原像素点
For i = 0 To 99
    pnt(i).BackColor = vbBlack
Next
End Sub

⌨️ 快捷键说明

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