?? form1.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1
Caption = "多次剪貼板"
ClientHeight = 2235
ClientLeft = 60
ClientTop = 345
ClientWidth = 5340
LinkTopic = "Form1"
ScaleHeight = 2235
ScaleWidth = 5340
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "全部清空"
Height = 495
Left = 1080
TabIndex = 4
Top = 1440
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "刪除"
Enabled = 0 'False
Height = 495
Left = 1080
TabIndex = 3
Top = 840
Width = 1215
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 630
Left = 0
TabIndex = 2
Top = 0
Width = 5340
_ExtentX = 9419
_ExtentY = 1111
ButtonWidth = 1640
ButtonHeight = 953
Appearance = 1
_Version = 393216
End
Begin VB.TextBox Text1
Height = 495
Left = 2400
TabIndex = 1
Top = 840
Width = 1215
End
Begin VB.Timer Timer1
Interval = 1000
Left = 4440
Top = 1320
End
Begin VB.ListBox List1
Height = 600
Left = 2400
TabIndex = 0
Top = 1440
Visible = 0 'False
Width = 1695
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const HWND_TOPMOST = -1
'定義常數的值
Dim cbtext As String
Dim i, j As Integer
Dim wd As Long
Private Sub Command1_Click()
'刪除指定條目
List1.RemoveItem Val(Text1.Text - 1) '移除索引號對應的條目(索引號從0開始)
Toolbar1.Buttons.Remove Val(Text1.Text) '移除對應的按鈕
Text1.Text = ""
End Sub
Private Sub Command2_Click()
'清空所有條目
For j = List1.ListCount To 1 Step 1
List1.RemoveItem j - 1
Toolbar1.Buttons.Remove j
Next j '清空所有的條目
i = 0
cbtext = "" '初始化變量
End Sub
Private Sub Form_Load()
'將本窗體置頂
wd = SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOMOVE Or SWP_NOSIZE)
End Sub
Private Sub Text1_Change()
If Val(Text1.Text) > 0 And Val(Text1.Text) <= List1.ListCount Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
If Clipboard.GetText = cbtext Or Clipboard.GetText = "" Then
'校驗剪貼板的文字是否與前一次的重復且是否為空
Exit Sub
End If
For j = 0 To List1.ListCount - 1
If Clipboard.GetText = List1.List(j) Then Exit Sub
'校驗是否有重復的,如有則不必再次復制
Next j
cbtext = Clipboard.GetText '獲得剪貼板的文字
i = i + 1
Toolbar1.Buttons.Add i, , Left(cbtext, 10) + "..."
'把新復制到剪貼板的內容的前10個字符相當于中文5個字符作為摘要,
' 添加到工具欄的新按鈕的標題上
List1.AddItem cbtext, i - 1 '把新獲得的內容通過List控件的AddItem方法添加進去
'Form1.Height = 1000 * (i + 1 / 4) + 1000 '設置窗體高度
Clipboard.Clear '清空剪貼板
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Clipboard.Clear
Clipboard.SetText List1.List(Button.Index - 1) '把相應條目復制到剪貼板
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -