📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 7890
ClientLeft = 165
ClientTop = 855
ClientWidth = 10065
LinkTopic = "Form1"
ScaleHeight = 526
ScaleMode = 3 'Pixel
ScaleWidth = 671
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Align = 2 'Align Bottom
Height = 885
Left = 0
ScaleHeight = 825
ScaleWidth = 10005
TabIndex = 2
Top = 7005
Width = 10065
Begin VB.Label lbcolor
BackColor = &H0000FFFF&
BorderStyle = 1 'Fixed Single
Height = 300
Index = 3
Left = 3705
TabIndex = 6
Top = 90
Width = 600
End
Begin VB.Label lbcolor
BackColor = &H00FF0000&
BorderStyle = 1 'Fixed Single
Height = 300
Index = 2
Left = 2955
TabIndex = 5
Top = 75
Width = 600
End
Begin VB.Label lbcolor
BackColor = &H0000FF00&
BorderStyle = 1 'Fixed Single
Height = 300
Index = 1
Left = 2160
TabIndex = 4
Top = 105
Width = 600
End
Begin VB.Label lbcolor
BackColor = &H000000FF&
BorderStyle = 1 'Fixed Single
Height = 300
Index = 0
Left = 1455
TabIndex = 3
Top = 90
Width = 600
End
End
Begin VB.PictureBox pictools
Align = 3 'Align Left
Height = 7005
Left = 0
ScaleHeight = 6945
ScaleWidth = 1065
TabIndex = 1
Top = 0
Width = 1125
Begin VB.PictureBox picLineWidth
Height = 1470
Left = 45
ScaleHeight = 1410
ScaleWidth = 870
TabIndex = 7
Top = 3870
Visible = 0 'False
Width = 930
Begin VB.Image Image2
Height = 480
Index = 2
Left = 75
Picture = "Form1.frx":0000
Top = 810
Width = 480
End
Begin VB.Image Image2
Height = 480
Index = 1
Left = 60
Picture = "Form1.frx":030A
Top = 450
Width = 480
End
Begin VB.Image Image2
Height = 480
Index = 0
Left = 75
Picture = "Form1.frx":0614
Top = 90
Width = 480
End
End
Begin VB.Image Image1
Height = 480
Index = 5
Left = 285
Picture = "Form1.frx":091E
Top = 2865
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 4
Left = 270
Picture = "Form1.frx":0C28
Top = 2235
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 3
Left = 315
Picture = "Form1.frx":0F32
Top = 1695
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 2
Left = 270
Picture = "Form1.frx":123C
Top = 1199
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 1
Left = 330
Picture = "Form1.frx":1546
Top = 660
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 0
Left = 435
Picture = "Form1.frx":1850
Top = 60
Width = 480
End
End
Begin VB.PictureBox picMain
Align = 4 'Align Right
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 7005
Left = -1965
ScaleHeight = 465
ScaleMode = 3 'Pixel
ScaleWidth = 800
TabIndex = 0
Top = 0
Width = 12030
Begin MSComDlg.CommonDialog cd1
Left = 4065
Top = 1170
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Filter = "Bmp Files|*.bmp|Jpg Files|*.jpg"
FilterIndex = 1
End
Begin VB.Image picsrc
Height = 1530
Left = 7230
Top = 2220
Visible = 0 'False
Width = 2295
End
End
Begin VB.Menu mnxPicture
Caption = "Picture"
Begin VB.Menu mnxImport
Caption = "Import"
End
Begin VB.Menu mnxLeftToRight
Caption = "LeftToRight"
End
Begin VB.Menu mnxSave
Caption = "Save"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim x0%, y0%, drawflag%
Private Sub Form_Load()
picMain.Width = Form1.ScaleWidth - pictools.Width
End Sub
Private Sub Form_Resize()
picMain.Width = Form1.ScaleWidth - pictools.Width
End Sub
Private Sub Image1_Click(Index As Integer)
drawflag = Index + 1
If (Index = 0) Then picLineWidth.Visible = True Else picLineWidth.Visible = False
End Sub
Private Sub Image2_Click(Index As Integer)
picMain.DrawWidth = Index + 1
End Sub
Private Sub lbcolor_Click(Index As Integer)
picMain.ForeColor = lbcolor(Index).BackColor
End Sub
Private Sub mnxImport_Click()
Dim picfile$
cd1.ShowOpen
picfile = cd1.FileName
picsrc.Picture = LoadPicture(picfile)
End Sub
Private Sub mnxLeftToRight_Click()
Dim dw%, i%
dw = picsrc.Width / picMain.ScaleWidth
For i = 1 To picMain.ScaleWidth
picMain.PaintPicture picsrc.Picture, 0, 0, i, picMain.ScaleHeight, picsrc.Width - i * dw, 0, i * dw, picsrc.Height, vbSrcCopy
DoEvents
Next i
End Sub
Private Sub mnxSave_Click()
cd1.ShowSave
SavePicture picMain.Image, cd1.FileName
End Sub
Private Sub picMain_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
x0 = X
y0 = Y
End If
End Sub
Private Sub picMain_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
picMain.AutoRedraw = False
picMain.Cls
Select Case drawflag
Case 1
picMain.Line (x0, y0)-(X, Y)
Case 2
picMain.Line (x0, y0)-(X, Y), , B
Case 3
picMain.Line (x0, y0)-(X, Y), , BF
Case 4
picMain.AutoRedraw = True
picMain.Line (x0, y0)-(X, Y)
x0 = X
y0 = Y
Case 5
picMain.FillStyle = 1
picMain.Circle (x0, y0), Sqr((X - x0) ^ 2 + (Y - y0) ^ 2)
Case 6
picMain.FillStyle = 0
picMain.FillColor = picMain.ForeColor
picMain.Circle (x0, y0), Sqr((X - x0) ^ 2 + (Y - y0) ^ 2)
End Select
End If
End Sub
Private Sub picMain_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
picMain.AutoRedraw = True
Select Case drawflag
Case 1
picMain.Line (x0, y0)-(X, Y)
Case 2
picMain.Line (x0, y0)-(X, Y), , B
Case 3
picMain.Line (x0, y0)-(X, Y), , BF
Case 5
picMain.FillStyle = 1
picMain.Circle (x0, y0), Sqr((X - x0) ^ 2 + (Y - y0) ^ 2)
Case 6
picMain.FillStyle = 0
picMain.FillColor = picMain.ForeColor
picMain.Circle (x0, y0), Sqr((X - x0) ^ 2 + (Y - y0) ^ 2)
End Select
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -