类型:转载 责任编辑:asp 日期:2007/03/01
各位高手:我想在text1中输入一些文本,然后通过复制、粘贴到text2中,可就是不行,总是报参数不对。剪切也一样,不知如何编写?程序如下:
private sub form_load()
clipboard.clear
end sub
private sub mnueditcopy_click()
if txtt1.sellength > 0 then
clipboard.settext = txtt1.seltext
end if
end sub
private sub mnueditcut_click()
if txtt1.sellength > 0 then
clipboard.settext = txtt1.seltext
txtt1.text = ""
end if
end sub
private sub mnueditexit_click()
end
end sub
private sub mnueditpaste_click()
if len(clipboard.gettext) > 0 then
txtt2.seltext = clipboard.gettext
end if
end sub
private sub mnusetting_click(index as integer)
if index = 0 then
cmdialog1.flags = 1
cmdialog1.showfont
txtt1.fontsize = cmdialog1.fontsize
txtt2.fontsize = cmdialog1.fontsize
end if
if index = 1 then
cmdialog1.showcolor
cmdialog1.showfont
txtt1.forecolor = cmdialog1.color
txtt2.forecolor = cmdialog1.color
end if
end sub
推荐阅读
private sub form_load()
clipboard.clear
end sub
private sub mnueditcopy_click()
if txtt1.sellength > 0 then
clipboard.settext txtt1.seltext
end if
end sub
private sub mnueditcut_click()
if txtt1.sellength > 0 then
clipboard.settext = txtt1.seltext
txtt1.text = ""
end if
end sub
private sub mnueditexit_click()
end
end sub
private sub mnueditpaste_click()
if len(clipboard.gettext) > 0 then
txtt2.seltext = clipboard.gettext
end if
end sub
private sub mnusetting_click(index as integer)
if index = 0 then
cmdialog1.flags = 1
cmdialog1.showfont
txtt1.fontsize = cmdialog1.fontsize
txtt2.fontsize = cmdialog1.fontsize
end if
if index = 1 then
cmdialog1.showcolor
cmdialog1.showfont
txtt1.forecolor = cmdialog1.color
txtt2.forecolor = cmdialog1.color
end if
end sub
clipboard.settext = txtt1.seltext
这里错了,settext是一个方法,不是属性,你可以给属性赋值,却不能给方法赋值,方法只能调用。
改成 clipboard.settext txtt1.seltext