分享
 
 
 

★★★敬请留意★★★:和微软一模一样的记事本的源代码(1)

王朝vb·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

Private Declare Function htmlhelp Lib _

"hhctrl.ocx" Alias "HtmlHelpA" _

(ByVal hwndCaller As Long, _

ByVal pszFile As String, ByVal _

uCommand As Long, ByVal dwData As Long) As Long

Dim Changed As Boolean

Dim Button As Integer

Private Type Rect

Left As Long

Top As Long

Right As Long

Bottom As Long

End Type

Private Type POINTAPI

X As Long

Y As Long

End Type

Private Type PageSetupDlg

lStructSize As Long

hwndOwner As Long

hDevMode As Long

hDevNames As Long

FLAGS As Long

ptPaperSize As POINTAPI

rtMinMargin As Rect

rtMargin As Rect

hInstance As Long

lCustData As Long

lpfnPageSetupHook As Long

lpfnPagePaintHook As Long

lpPageSetupTemplateName As String

hPageSetupTemplate As Long

End Type

Private Declare Function PageSetupDlg Lib "comdlg32.dll" Alias "PageSetupDlgA" _

(pPagesetupdlg As PageSetupDlg) As Long

Dim PageSetup As PageSetupDlg

Dim Pflag As Long

Dim Pmode As Long

Dim Psize As POINTAPI

Private Sub Form_Load()

Form1.Caption = "NoTitled-notePad"

mnuUndo.Caption = "撤消(&U)" + Chr(9) + "Ctrl+Z"

mnuJian.Caption = "剪切(&T)" + Chr(9) + "Ctrl+X"

mnuCopy.Caption = "复制(&C)" + Chr(9) + "Ctrl+C"

mnuPaste.Caption = "粘贴(&P)" + Chr(9) + "Ctrl+V"

mnuJian.Enabled = False

mnuUndo.Enabled = False

mnuCopy.Enabled = False

mnuDelete.Enabled = False

If Clipboard.GetText() <> "" Then

mnuPaste.Enabled = True

Else

mnuPaste.Enabled = False

End If

'Text1.SelAlignment = Null

Changed = False

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

If Changed = True Then

Button = MsgBox(Form1.Caption + "file has changed," + Chr(13) + "do you save?", vbYesNoCancel + vbExclamation)

If Button = vbYes Then

mnuSave_Click

End

ElseIf Button = vbNo Then

End

End If

Cancel = True

Else

End

End If

End Sub

Private Sub Form_resize()

Text1.Top = ScaleTop

Text1.Left = ScaleLeft

Text1.Width = ScaleWidth

Text1.Height = ScaleHeight

End Sub

Private Sub mnuAbout_Click()

Form4.Show

End Sub

Private Sub mnuAll_Click()

Text1.SelStart = 0

Text1.SelLength = Len(Text1.Text)

End Sub

Private Sub mnuCline_Click()

mnuCline.Checked = Not mnuCline.Checked

If mnuCline.Checked = True Then

Text1.RightMargin = 0

Else

Text1.RightMargin = 2500

End If

End Sub

Private Sub mnuCopy_Click()

SendKeys "^{insert}"

End Sub

Private Sub mnuDate_Click()

Dstring = FormatDateTime(Now, 4) + Space(2) + FormatDateTime(Now, 2)

SendKeys Dstring

End Sub

Private Sub mnuDelete_Click()

Text1.SelText = ""

End Sub

Private Sub mnuExit_Click()

If Changed = True Then

Button = MsgBox(Form1.Caption + "file has changed," + Chr(13) + "do you save?", vbYesNoCancel + vbExclamation)

If Button = vbYes Then

mnuSave_Click

ElseIf Button = vbNo Then

End

End If

Else

End

End If

End Sub

Private Sub mnuFind_Click()

Form2.Show

End Sub

Private Sub mnuFont_Click()

CommonDialog1.FontName = Text1.SelFontName

CommonDialog1.FLAGS = FontsConstants.cdlCFScreenFonts

CommonDialog1.FontStrikethru = Text1.SelStrikeThru

CommonDialog1.FontBold = Text1.SelBold

CommonDialog1.FontItalic = Text1.SelItalic

CommonDialog1.FontUnderline = Text1.SelUnderline

CommonDialog1.FontSize = Text1.SelFontSize

CommonDialog1.FontStrikethru = Text1.SelStrikeThru

CommonDialog1.Color = Text1.SelColor

CommonDialog1.ShowFont

'Text1.SelFontName = CommonDialog1.FontName

'Text1.SelStrikeThru = CommonDialog1.FontStrikethru

'Text1.SelBold = CommonDialog1.FontBold

'Text1.SelColor = CommonDialog1.Color

'Text1.SelItalic = CommonDialog1.FontItalic

'Text1.SelUnderline = CommonDialog1.FontUnderline

'Text1.SelFontSize = CommonDialog1.FontSize

'Text1.SelStrikeThru = CommonDialog1.FontStrikethru

Text1.Font.Bold = CommonDialog1.FontBold

Text1.Font.Italic = CommonDialog1.FontItalic

Text1.Font.Name = CommonDialog1.FontName

Text1.Font.Size = CommonDialog1.FontSize

End Sub

Private Sub mnuGoto_Click()

Form3.Show

'Form3.SetFocus = Form3.Text1.Text

End Sub

Private Sub mnuHelpTopic_Click()

'App.HelpFile = "e:\notepad\note.CHM"

'SendKeys "{F1}"

'yeah = shellExecute(Form1.hwnd, "open", "e:\notepad\note.CHM", Null, Null, SW_SHOWNORMAL)

'Shell "e:\notepad\note.chm", vbNormalFocus

'Shell "hh " + App.Path + "\note.chm", vbNormalFocus

'Shell "e:\notepad\note.CHM", vbNormalFocus

htmlhelp hwnd, "d:\notepad\note.CHM", 0, 0

End Sub

Private Sub mnuJian_Click()

SendKeys "+{del}"

End Sub

Private Sub mnuline7_Click(Index As Integer)

Dim i As Integer

CommonDialog1.ShowOpen

End Sub

Private Sub mnuNew_Click()

If Changed = True Then

Button = MsgBox(Form1.Caption + "file has changed," + Chr(13) + "do you save?", vbYesNoCancel + vbExclamation)

If Button = vbYes Then

mnuSave_Click

End If

End If

Text1.Text = ""

Form1.Caption = "NoTitled-notePad"

Changed = False

End Sub

Private Sub mnuNext_Click()

If Gstring <> "" Then

Form2.Visible = False

Form2.Command1_Click

Else

Form2.Visible = True

End If

End Sub

Private Sub mnuOpen_Click()

If Changed = True Then

Button = MsgBox(Form1.Caption + "file has changed," + Chr(13) + "do you save?", vbYesNoCancel + vbExclamation)

If Button = vbYes Then

mnuSave_Click

End If

End If

CommonDialog1.ShowOpen

file = CommonDialog1.FileName

If file <> "" Then

Form1.Caption = file

Open file For Input As #1

If Not EOF(file) Then Text1.Text = Input(LOF(1), #1)

Close #1

Changed = False

End If

End Sub

Private Sub mnuPage_Click()

With PageSetup

.lStructSize = Len(PageSetup)

.hwndOwner = hwnd

PageSetupDlg PageSetup

Pflag = .FLAGS

Psize = .ptPaperSize

Pmode = .hDevMode

End With

'Pflag = PageSetupDlg(PageSetup)

'Text1.SetFocus

End Sub

Private Sub mnuPaste_Click()

SendKeys "+{insert}"

End Sub

Private Sub mnuPrint_Click()

CommonDialog1.FLAGS = Pmode

'If Text1.SelLength = 0 Then

' CommonDialog1.FLAGS = cdlPDReturnDC + cdlPDAllPages

'Else

' CommonDialog1.FLAGS = cdlPDReturnDC + cdlPDSelection

'End If

CommonDialog1.ShowPrinter

On Error GoTo trip

Printer.Print ""

If CommonDialog1.hDC > 0 Then Text1.Print CommonDialog1.hDC

Printer.EndDoc

trip: End Sub

Private Sub mnuReplace_Click()

FrmReplace.Show

End Sub

Private Sub mnuSave_Click()

If Form1.Caption = "NoTitled-notePad" Then

CommonDialog1.DialogTitle = "save"

CommonDialog1.ShowSave

file = CommonDialog1.FileName

If file <> "" Then

Form1.Caption = file

Open file For Output As #1

Print #1, Text1.Text

Close #1

End If

Else

file = Form1.Caption

Open file For Output As #1

Print #1, Text1.Text

Close #1

End If

End Sub

Private Sub mnuSaveAs_Click()

CommonDialog1.DialogTitle = "save as "

CommonDialog1.ShowSave

file = CommonDialog1.FileName

If file <> "" Then

Form1.Caption = file

Open file For Output As #1

Print #1, Text1.Text

Close #1

End If

End Sub

Private Sub mnuUndo_Click()

SendKeys "^{z}"

End Sub

Private Sub Text1_Change()

Changed = True

mnuUndo.Enabled = True

End Sub

Private Sub Text1_SelChange()

If Text1.SelLength <> 0 Then

mnuJian.Enabled = True

mnuCopy.Enabled = True

mnuDelete.Enabled = True

Else

mnuJian.Enabled = False

mnuCopy.Enabled = False

mnuDelete.Enabled = False

End If

End Sub

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有