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