?? editexmpl.txt
字號:
'Example of editing using a Menu
'May edit text or picture controls
Option Explicit
Private Sub cmdLoad_Click()
'Note use of App.Path to specify the directory
'where the application resides
'As long as the picture file is with the .vbp file,
'it can be loaded without a specific path
Dim pictName As String
pictName = App.Path & "\footb2.jpg"
Picture1.Picture = LoadPicture(pictName)
End Sub
Private Sub Form_Load()
'Standard routine to center form on screen
'Can be copied and pasted in any application
'Me stands for active form
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub mnuEdit_Click()
'All menu functions are disabled until
'we decide what we want to do.
mnuCut.Enabled = False
mnuCopy.Enabled = False
mnuPaste.Enabled = False
mnuClear.Enabled = False
'If cursor is in a textbox and text has been selected,
'Cut and Copy are enabled
'If there is text in the Clipboard,
'Paste is enabled
If TypeOf Screen.ActiveControl Is TextBox Then
If Screen.ActiveControl.SelLength Then
mnuCut.Enabled = True
mnuCopy.Enabled = True
End If
If Clipboard.GetFormat(vbCFText) Then
mnuPaste.Enabled = True
End If
End If
If TypeOf Screen.ActiveControl Is PictureBox Then
mnuCut.Enabled = True
mnuCopy.Enabled = True
If Clipboard.GetFormat(vbCFBitmap) Or Clipboard.GetFormat(vbCFDIB) _
Or Clipboard.GetFormat(vbCFMetafile) Then
mnuPaste.Enabled = True
End If
End If
If Clipboard.GetFormat(vbCFText) Or Clipboard.GetFormat(vbCFBitmap) Or _
Clipboard.GetFormat(vbCFMetafile) Or Clipboard.GetFormat(vbCFDIB) Then
mnuClear.Enabled = True
End If
End Sub
Private Sub mnuPaste_Click()
If TypeOf Screen.ActiveControl Is TextBox And _
Clipboard.GetFormat(vbCFText) Then
Screen.ActiveControl.SelText = Clipboard.GetText()
Exit Sub
End If
If TypeOf Screen.ActiveControl Is PictureBox _
And Clipboard.GetFormat(vbCFBitmap) Then
Screen.ActiveControl.Picture = Clipboard.GetData()
Exit Sub
End If
End Sub
Private Sub mnuCopy_Click()
If TypeOf Screen.ActiveControl Is TextBox Then
If Screen.ActiveControl.SelLength Then
Clipboard.Clear
Clipboard.SetText Screen.ActiveControl.SelText
Exit Sub
End If
End If
If TypeOf Screen.ActiveControl Is PictureBox Then
Clipboard.Clear
Clipboard.SetData Screen.ActiveControl.Image
End If
End Sub
Private Sub mnuCut_Click()
Dim StartPos, SelLength, EndPos As Integer
Dim Temp As String
mnuCopy_Click
If TypeOf Screen.ActiveControl Is TextBox Then
StartPos = Screen.ActiveControl.SelStart
SelLength = Screen.ActiveControl.SelLength
Temp = Left(Screen.ActiveControl.Text, StartPos)
EndPos = Len(Screen.ActiveControl.Text) - (StartPos + SelLength)
Temp = Temp + Right(Screen.ActiveControl.Text, EndPos)
Screen.ActiveControl.Text = Temp
Exit Sub
End If
If TypeOf Screen.ActiveControl Is PictureBox Then
Screen.ActiveControl.Picture = LoadPicture("")
End If
End Sub
Private Sub mnuClear_Click()
Clipboard.Clear
End Sub
Private Sub cmdExit_Click()
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -