📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form formCopyShapes
BorderStyle = 1 'Fixed Single
Caption = "Copy Shapes"
ClientHeight = 5865
ClientLeft = 45
ClientTop = 330
ClientWidth = 6060
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5865
ScaleWidth = 6060
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox cmboChoosePicture
Height = 300
Left = 3060
Style = 2 'Dropdown List
TabIndex = 1
Top = 5400
Width = 2055
End
Begin VB.CommandButton cmndCopyShape
Caption = "&Copy Shape"
Height = 315
Left = 1200
TabIndex = 0
Top = 5400
Width = 1215
End
Begin VB.PictureBox PictCopy
Height = 5055
Left = 60
ScaleHeight = 4995
ScaleWidth = 5895
TabIndex = 2
Top = 60
Width = 5955
End
End
Attribute VB_Name = "formCopyShapes"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private collSavePictures As New Collection
Private Const MAX_PICTURES = 10
Private Sub cmboChoosePicture_Click()
Dim opicPicture As Picture
If cmboChoosePicture.ListIndex = -1 Then
Exit Sub
End If
Set opicPicture = collSavePictures.Item(cmboChoosePicture.ListIndex + 1)
PictCopy.Picture = opicPicture
End Sub
Private Sub cmndCopyShape_Click()
Dim opicPicture As Picture
PictCopy.PaintPicture formShapes!PictSurface.Image, 0, 0
Set opicPicture = formShapes!PictSurface.Image
'此外不能为 Set opicPicture = PictCopy.image ,原因有待考证。
AddtoArray opicPicture
Set opicPicture = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set collSavePictures = Nothing
Unload Me
End Sub
Private Sub PictCopy_Click()
cmndCopyShape = True
End Sub
Private Sub AddtoArray(opicPicture As Picture)
If collSavePictures.Count >= MAX_PICTURES Then
collSavePictures.Remove 1
End If
collSavePictures.Add Item:=opicPicture
If cmboChoosePicture.ListCount < MAX_PICTURES Then
cmboChoosePicture.AddItem "Picture" & Format(collSavePictures.Count)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -