📄 frmcreateguid.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = " Demo Generating a Globally Unique Identifier (GUID)"
ClientHeight = 3255
ClientLeft = 60
ClientTop = 675
ClientWidth = 6300
Icon = "frmCreateGuid.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3255
ScaleWidth = 6300
Begin VB.CommandButton Command1
Caption = "&Copy to Clipboard"
Height = 495
Index = 1
Left = 3180
TabIndex = 3
Top = 2640
Width = 2895
End
Begin VB.CommandButton Command1
Caption = "&Generate New GUID"
Height = 495
Index = 0
Left = 120
TabIndex = 1
Top = 2640
Width = 2895
End
Begin VB.ListBox List1
BackColor = &H8000000F&
BeginProperty Font
Name = "Fixedsys"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000012&
Height = 1860
IntegralHeight = 0 'False
Left = 120
TabIndex = 0
Top = 660
Width = 6015
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "Choose the desired GUID below, then select ""Copy"" to copy it to the clipboard."
Height = 480
Left = 1500
TabIndex = 2
Top = 120
Width = 4035
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileItem
Caption = "E&xit"
Index = 0
End
End
Begin VB.Menu mnuHelp
Caption = "&Help"
Begin VB.Menu mnuHelpItem
Caption = "&About"
Index = 0
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' frmCreateGUID - Demo creating a Globally Unique Identifier (GUID)
' 1997/07/11 Copyright 1997, Larry Rebich, The Bridge, Inc.
Option Explicit
DefLng A-Z
Private Sub Command1_Click(Index As Integer)
Dim sTemp As String
Select Case Index
Case 0 'generate
With List1
.AddItem " " & CreateGUID()
.Selected(.ListCount - 1) = True
End With
Case 1 'copy
With List1
sTemp = Trim$(.Text)
Clipboard.Clear '2001/10/25
Clipboard.SetText sTemp
End With
End Select
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2 'simple center
Command1_Click 0
End Sub
Private Sub Form_Resize()
Dim l, t, w, h
' Commands
With Command1(0)
w = ScaleWidth * 0.48
t = ScaleHeight - .Height * 1.2
l = ((ScaleWidth \ 2) - w) \ 2
.Move l, t, w
End With
With Command1(1)
l = ScaleWidth - w - l
.Move l, t, w
End With
' Label1
With Label1
l = (ScaleWidth - .Width) \ 2
.Left = l
End With
' List1
With List1
w = ScaleWidth * 0.96
l = (ScaleWidth - w) \ 2
t = .Top
h = ScaleHeight - t - Command1(0).Height - 300
If h < 100 Then
h = 100
End If
.Move l, t, w, h
End With
End Sub
Private Sub mnuFileItem_Click(Index As Integer)
Select Case Index
Case 0
Unload Me
End Select
End Sub
Private Sub mnuHelpItem_Click(Index As Integer)
Select Case Index
Case 0
DoAbout
End Select
End Sub
Private Sub DoAbout()
Dim sMsg As String
sMsg = App.EXEName & vbCr & App.LegalCopyright
MsgBox sMsg, vbInformation, " " & App.Title
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -