Traditional Culture Encyclopedia - Hotel accommodation - Kneel for the master of VB course design
Kneel for the master of VB course design
————————————— Appendix Program List and Precautions
Program Listing 6. 1
Option explicit
Fuzzy Fi
LeName As String' file name, used to open and save files.
"Dim UndoString As String" is used to undo the operation.
"Dim UndoNew As String" is used to undo the operation.
Private Submgundodisable ()
Disable the Undo button.
UndoString = " "
UndoNew = " "
Imgundo. Enabled = False
Imgundo. Image = ImageDisable. ListImages ("revocation"). draw
End joint
Private Submgundoenable ()
A valid Undo button.
Imgundo. Enabled = true
Imgundo. Image = ImageUp. ListImages ("revocation"). draw
End joint
Private Subcheck _ImgPaste ()
Set the paste button
If Len (clipboard. GetText)& gt; Then 0
ImgPaste。 Enabled = true
ImgPaste。 Image = ImageUp. ListImages ("paste") draw
other
ImgPaste。 Enabled = False
ImgPaste。 Image = ImageDisable. ListImages ("paste") draw
If ... it will be over.
End joint
Private Sub Check_ImgCutCopy()
Set the cut and copy buttons
If Text 1. SelLength & gt So 0
ImgCut。 Enabled = true
ImgCut。 Image = ImageUp. ListImages ("cut"). draw
ImgCopy。 Enabled = true
ImgCopy。 Image = ImageUp. ListImages ("copy"). draw
other
ImgCut。 Enabled = False
ImgCut。 Image = ImageDisable. ListImages ("cut"). draw
ImgCopy。 Enabled = False
ImgCopy。 Image = ImageDisable. ListImages ("copy"). draw
If ... it will be over.
End joint
Private Sub BackColor_Click ()
CommonDialog 1。 Display color
Text 1。 BackColor = CommonDialog 1。 colour
End joint
Private subframe _Click ()
Show stop toolbar
If box. I checked it.
The toolbar will be stopped.
Box. Checked = False
CoolBar 1。 Visible = false
other
Box. Checked = true
CoolBar 1。 Visible = True[NextPage]
If ... it will be over.
Form_Resize' repositions the control.
End joint
Private Sub Close_Click ()
Dim FileNum is an integer.
If Len (file name) > then 0
There is an input file name.
FileNum = FreeFile ()' to get the available file number.
Open file name as FileNum output' Open output file.
If no file is specified, a new file is created.
Print #FileNum,Text 1。 Text outputs text.
Close the file.
If ... it will be over.
Text 1。 Text = ""
File name = ""
End joint
Private Sub ComboSize_Click()
Text 1。 FontSize = Val(ComboSize。 Text)
End joint
Private Subassembly Function _Click ()
Text 1。 FontName = ComboFont。 text
End joint
Private child copy _Click ()
Clipboard. settexttext 1。 Seltext' copies text to clipboard.
End joint
Private child Cut_Click ()
Clipboard. settexttext 1。 Seltext' copies text to clipboard.
Text 1。 SelText = ""'Clears the selected text.
End joint
Private child data Time_Click ()
Text 1。 SelText = Now
End joint
Private child Delete_Click ()
Text 1。 SelText = ""'Clears the selected text.
End joint
Private Subeditor _ Click ()
Triggers the program before the edit submenu is displayed.
If Text 1. SelLength & gt So 0
There is selected text in the text box.
Stop. Enabled = true
Roger that. Enabled = true
Delete. Enabled = true
other
Stop. Enabled = False
Roger that. Enabled = False
Delete. Enabled = False
If ... it will be over.
If Len (clipboard. GetText())& gt; Then 0
There is text data in the clipboard.
Paste. Enabled = true
other
There is no text to paste.
Paste. Enabled = False
If ... it will be over.
End joint
Private child exits _Click ()
Unload me.
End joint
Private subffindtext _ keypress (keyascii is an integer)
Dim BeginPos As Long
If KeyAscii = 13, then
BeginPos = InStr( 1,Text 1。 Text, find text. Text, vbTextCompare)
If BeginPos & gt then 0
Text 1。 SelStart = BeginPos - 1
Text 1。 SelLength = Len(FindText。 Text)
If ... it will be over.
If ... it will be over.
End joint
Private Sub Fontcolor_Click()
CommonDialog 1。 Display color
Text 1。 ForeColor = CommonDialog 1。 colour
End joint
Private Sub-Form _Load ()
Mark I as an integer
Load image
ImgNew。 Image = ImageUp. ListImages ("new"). draw
ImgOpen。 Image = ImageUp. ListImages ("open"). draw
ImgSave。 Image = ImageUp. ListImages ("save"). draw
Imgundo. Image = ImageDisable. ListImages ("revocation"). draw
Check _ Paste
Check_ImgCutCopy
Load system fonts
Filter for i = 0. FontCount - 1
ComboFont。 Add project screen. Font (1)
Next, I
End joint
Private Sub-Form _Resize ()
Dim TextTop As Long
Modify toolbar size
CoolBar 1。 Top = me. Weighing roof
Me. Zoom left
Text 1。 Width = me. Scale width
If I ... ScaleHeight & gtCoolBar 1。 What about height?
Text 1。 Height = me. ScaleHeight - TextTop
other
Text 1。 Height = 0
If ... it will be over.
End joint
Private Sub ImgCopy_Click ()
Copy _ Click' Copy'
Check _ Paste
Check_ImgCutCopy
End joint
Private subimg copy _ mousedown (button is an integer, Shift is an integer,
X means single, y means single)
"Press" button
If Button = 1
ImgCopy。 Image = ImageDown. ListImages ("copy"). draw
If ... it will be over.
End joint
Private subimg copy _ mousemove (button is an integer, Shift is an integer,
X means single, y means single)
Label 1 = "Copy the selected text to the clipboard"
Determine the mouse position and display different images.
If Button = 1 and (X>0 and X & ltImgNew. Width and Y>0 and y <
ImgNew。 Height) and then
ImgCopy。 Image = ImageDown. ListImages ("copy"). Picture [next page]
ElseIf Button = 1 and then
ImgCopy。 Image = ImageUp. ListImages ("copy"). draw
If ... it will be over.
End joint
Private subimg copy _ mouseup (button is an integer, Shift is an integer, x
Single, y single)
If Button = 1
"Lift" button
ImgCopy。 Image = ImageUp. ListImages ("copy"). draw
If ... it will be over.
End joint
Private Sub ImgCut_Click()
If Text 1. SelLength & gt So 0
Cut _ Click "Cut"
Check _ Paste
Check_ImgCutCopy
If ... it will be over.
End joint
Private subimg cut _ mousedown (button is an integer, Shift is an integer,
X means single, y means single)
If Button = 1
"Press" button
ImgCut。 Image = ImageDown. ListImages ("cut"). draw
If ... it will be over.
End joint
Private subimg cut _ mousemove (button is an integer, Shift is an integer,
X means single, y means single)
Label 1 = "Cut the selected text to the clipboard"
Determine the mouse position and display different images.
If Button = 1 and (X>0 and X & ltImgNew. Width and Y>0 and y <
ImgNew。 Height) and then
ImgCut。 Image = ImageDown. ListImages ("cut"). draw
ElseIf Button = 1 and then
ImgCut。 Image = ImageUp. ListImages ("cut"). draw
If ... it will be over.
End joint
Private subimg cut _ mouseup (button is an integer, Shift is an integer, x
Single, y single)
If Button = 1
"Lift" button
ImgCut。 Image = ImageUp. ListImages ("cut"). draw
If ... it will be over.
End joint
Private Sub ImgNew_Click ()
New _ Click
End joint
Private subimg new _ mousedown (button is an integer, Shift is an integer,
X means single, y means single)
If Button = 1
"Press" button
ImgNew。 Image = ImageDown. ListImages ("new"). draw
If ... it will be over.
End joint
Private subimg new _ mousemove (button is an integer, Shift is an integer,
X means single, y means single)
Label 1 = "New file"' Modify the prompt information.
Determine the mouse position and display different images.
If Button = 1 and (X>0 and X & ltImgNew. Width and Y>0 and y <
ImgNew。 Height) and then
ImgNew。 Image = ImageDown. ListImages ("new"). draw
ElseIf Button = 1 and then
ImgNew。 Image = ImageUp. ListImages ("new"). draw
If ... it will be over.
End joint
Private subimg new _ mouseup (button is an integer, Shift is an integer.
Eger, x means single, y means single)
If Button = 1
"Lift" button
ImgNew。 Image = ImageUp. ListImages ("new"). draw
If ... it will be over.
End joint
Private Sub ImgOpen_Click ()
Open _ click
End joint
Private submagopen _ mousedown (button is an integer, Shift is an integer,
X means single, y means single)
"Press" button
If Button = 1
ImgOpen。 Image = ImageDown. ListImages ("open"). draw
If ... it will be over.
End joint
Private submagopen _ mousemove (button is an integer, Shift is an integer,
X means single, y means single)
Label 1 = "Select a file name and open it"
Determine the mouse position and display different images.
If Button = 1 and (X>0 and X & ltImgNew. Width and Y>0 and y <
ImgNew。 Height) and then
ImgOpen。 Image = ImageDown. ListImages ("open"). draw
ElseIf Button = 1 and then
ImgOpen。 Image = ImageUp. ListImages ("open"). draw
If ... it will be over.
End joint
Private submagopen _ mouseup (button is an integer, Shift is an integer, x
Single, y single)
If Button = 1
"Lift" button
ImgOpen。 Image = ImageUp. ListImages ("open"). draw
If ... it will be over.
End joint
Private Sub ImgPaste_Click()
Paste _ Click Paste.
End joint
Private subimg paste _ mousedown (button is an integer, Shift is
Integer, x for single value, y for single value)
If Button = 1
"Press" button
ImgPaste。 Image = ImageDown. ListImages ("paste") Picture [next page]
If ... it will be over.
End joint
Private subimg paste _ mousemove (button is an integer, Shift is
Integer, x for single value, y for single value)
Label 1 = "Paste the text to the current cursor position"
Determine the mouse position and display different images.
If Button = 1 and (X>0 and X & ltImgNew. Width and Y>0 and y <
ImgNew。 Height) and then
ImgPaste。 Image = ImageDown. ListImages ("paste") draw
ElseIf Button = 1 and then
ImgPaste。 Image = ImageUp. ListImages ("paste") draw
If ... it will be over.
End joint
Private subimg paste _ mouseup (button is an integer, Shift is an integer,
X means single, y means single)
If Button = 1
"Name the output FileNum" to open the output file.
If no file is specified, a new file is created.
Print #FileNum,Text 1。 Text outputs text.
Close the file.
ImgUndoDisable
other
MsgBox "Unknown file cannot be saved"+CHR (13)+CHR (10)+"Please select the file menu.
Save "Project", "Warning"
If ... it will be over.
End joint
Private subimg save _ mousedown (button is an integer, Shift is an integer,
X means single, y means single)
If Button = 1
ImgSave。 Image = ImageDown. ListImages ("save"). draw
If ... it will be over.
End joint
Private subimg save _ mousemove (button is an integer, Shift is an integer,
X means single, y means single)
Label 1 = "Save current file"
Determine the mouse position and display different images.
If Button = 1 and (X>0 and X & ltImgNew. Width and Y>0 and y <
ImgNew。 Height) and then
ImgSave。 Image = ImageDown. ListImages ("save"). draw
ElseIf Button = 1 and then
ImgSave。 Image = ImageUp. ListImages ("save"). draw
If ... it will be over.
Private subimgundo _ mousemove (button is an integer, Shift is an integer,
X means single, y means single)
Label 1 = "Cancel current operation"
Determine the mouse position and display different images.
If Button = 1 and (X>0 and X & ltImgNew. Width and Y>0 and y <
ImgNew。 Height) and then
Imgundo. Image = ImageDown. ListImages ("revocation"). draw
ElseIf Button = 1 and then
Imgundo. Image = ImageUp. ListImages ("revocation"). draw
If ... it will be over.
End joint
Private subimgundo _ mouseup (button is an integer, Shift is an integer, x
Single, y single)
If Button = 1
"Lift" button
Imgundo. Image = ImageUp. ListImages ("revocation"). draw
If ... it will be over.
End joint
Private Sub New_Click()
File name = ""
Text 1 = " "
ImgUndoDisable
End joint
Private child Open_Click ()
Dim FileNum is an integer.
Adjust the buffer to a string.
Dim buffer 1 as a string
Dim file size is Long.
Dim MaxLen As Long
MaxLen = 32768' Maximum file length
CommonDialog 1。 Displays the Open File dialog box.
If Len(CommonDialog 1。 File name) >; Then 0
There is an input file name.
Filename = public dialog box 1. File name saves the file name.
FileSize = FileLen(FileName)' to get the file length.
If the file size is & gtMaxLen Then[NextPage]
The file is too long.
MsgBox "This file is too large to display only part of the text", "Warning"
outlet connection
If ... it will be over.
Screen. Mouseporter = 1 1' Set the mouse as an hourglass.
FileNum = FreeFile ()' to get the available file number.
Open input file name in FileNum format opens the file in sequential input mode.
Do While Not EOF(FileNum) and len (buffer) < Reading requires less than "MaxLen" text.
32K
Line input # filenum, buffer 1' to read a line of text.
Buffer = buffer+buffer1+chr (13)+chr (10)' Add carriage return line break.
"cycle" cycle body
Close the file.
ImgUndoDisable cancels the undo function.
Text 1。 Text = buffer' displays the text.
UndoNew = buffer' saves the text.
Buffer = ""'Releases memory.
buffer 1 = " "
Screen. MousePointer = 0' resumes mouse pointer.
Me. Caption = "Notepad-"+FileName' to modify the title display.
If ... it will be over.
End joint
Private Sub-Paste _ Click ()
Text 1。 SelText = clipboard. GetText
End joint
Private sub-picture 1_MouseMove(Button is an integer, Shift is
Integer, x for single value, y for single value)
Label 1 = "Toolbar"
End joint
Private sub-picture 1_Resize ()
If the picture 1. Width & gtLabel 1. Then to the left
Label 1。 Width = picture 1. ScaleWidth-Label 1 left
If ... it will be over.
End joint
Private Sub Save_Click ()
"Dim FileNum As Integer" file handle number.
CommonDialog 1。 Show Save displays the save dialog box.
If Len(CommonDialog 1。 File name) >; Then 0
There is an input file name.
Filename = public dialog box 1. File name saves the file name.
FileNum = FreeFile ()' to get the available file number.
Open file name as FileNum output' Open output file.
If no file is specified, a new file is created.
Print #FileNum,Text 1。 Text outputs text.
Close the file.
Me. Caption = "Notepad-"+FileName' to modify the title display.
ImgUndoDisable
If ... it will be over.
End joint
Private Subtext 1_Change ()
If it wasn't for ImgUndo, Then enable
Make the Undo button available.
ImgUndoEnable
If ... it will be over.
UndoString = UndoNew
UndoNew = Text 1
End joint
Private Subtext 1_Click ()
Check_ImgCutCopy
End joint
Private subtext1_ keyup (keycode is an integer, Shift is an integer)
Check_ImgCutCopy
End joint
End joint
Private subimg save _ mouseup (button is an integer, Shift is an integer, x
Single, y single)
If Button = 1
"Lift" button
ImgSave。 Image = ImageUp. ListImages ("save"). draw
If ... it will be over.
End joint
Private Sub ImgUndo_Click()
Text 1。 Text = UndoString
End joint
Private subimgundo _ mousedown (button is an integer, Shift is an integer,
X means single, y means single)
If Button = 1
"Press" button
Imgundo. Image = ImageDown. ListImages ("revocation"). draw
If ... it will be over.
End joint
- Related articles
- How about Shenyang Dongsheng da cable co., ltd
- I want to open a small tobacco hotel in the community. Is it better to be near the school or far away?
- National Day Activities of 22 Overseas Chinese Town Theme Hotels in East Shenzhen
- What should I pay attention to when traveling to five cities in East China now?
- Which hotel in Xi 'an has a buffet annual card?
- What is the highest end of Qingdao Hisense Real Estate Company?
- How far is Heinsburg from Berlin?
- What kind of man was Alexander and what influence did he have on the Spartan navy?
- Nanchang Tenica Hotel was the first international brand hotel in Nanchang.
- Who knows the TV series of TVB! The more the better!