如何让文字显示在上面[已解决]
本帖最后由 清风飘飘 于 2011-1-18 22:44 编辑第一次接触脚本,因工作需要,要做一个类似QQ聊天框的东西,可是不知道怎么把下面输入的内容显示在上面。
下面是我写的代码,不知道那位朋友愿意帮我一下:
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=e:\program files\form1.kxf
$Form1_1 = GUICreate("交流", 604, 461, 368, 133)
$MenuItem1 = GUICtrlCreateMenu("文件(&W)")
$MenuItem5 = GUICtrlCreateMenuItem("新建", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("打开", $MenuItem1)
$MenuItem7 = GUICtrlCreateMenuItem("关闭", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("编辑(&X)")
$MenuItem8 = GUICtrlCreateMenuItem("字体", $MenuItem2)
$MenuItem12 = GUICtrlCreateMenuItem("复制", $MenuItem2)
$MenuItem13 = GUICtrlCreateMenuItem("剪切", $MenuItem2)
$MenuItem11 = GUICtrlCreateMenuItem("粘贴", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("工具(&Y)")
$MenuItem9 = GUICtrlCreateMenuItem("截屏", $MenuItem3)
$MenuItem4 = GUICtrlCreateMenu("帮助(&Z)")
$MenuItem10 = GUICtrlCreateMenuItem("关于", $MenuItem4)
$Button1 = GUICtrlCreateButton("确定", 512, 408, 75, 25)
$Button2 = GUICtrlCreateButton("关闭", 416, 408, 75, 25)
$Date1 = GUICtrlCreateDate("", 408, 264, 186, 21)
$Input1 = GUICtrlCreateInput("", 8, 288, 585, 115)
$Label1 = GUICtrlCreateLabel("", 8, 8, 588, 249,$SS_BLACKFRAME)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("TrayIconHide", 1)
Dim $a,$B,$c,$q
$c=@YEAR&'-'&@MON&'-'&@MDAY
$B=@HOUR&':'&@MIN&':'&@SEC
$q=FileExists("E:\Program Files\Adobe")
If $q=0 Then
DirCreate("E:\Program Files\Adobe")
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
$a=MsgBox(1+32,"关闭","确定要退出么?")
Select
Case $a=2
GUIGetMsg()
Case $a=1
Exit
EndSelect
Case $Button1
IniWrite("E:\Program Files\Adobe\admin.ini", "日期:"&$c, $B, GUICtrlRead($Input1))
EndSwitch
WEnd 回复 1# 清风飘飘
没看懂你什么意思,不知道是不是这个意思,看下面代码,记住以后发代码请用下面格式
就是点击"<> "这个按钮#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=e:\program files\form1.kxf
$Form1_1 = GUICreate("交流", 604, 461, 368, 133)
$MenuItem1 = GUICtrlCreateMenu("文件(&W)")
$MenuItem5 = GUICtrlCreateMenuItem("新建", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("打开", $MenuItem1)
$MenuItem7 = GUICtrlCreateMenuItem("关闭", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("编辑(&X)")
$MenuItem8 = GUICtrlCreateMenuItem("字体", $MenuItem2)
$MenuItem12 = GUICtrlCreateMenuItem("复制", $MenuItem2)
$MenuItem13 = GUICtrlCreateMenuItem("剪切", $MenuItem2)
$MenuItem11 = GUICtrlCreateMenuItem("粘贴", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("工具(&Y)")
$MenuItem9 = GUICtrlCreateMenuItem("截屏", $MenuItem3)
$MenuItem4 = GUICtrlCreateMenu("帮助(&Z)")
$MenuItem10 = GUICtrlCreateMenuItem("关于", $MenuItem4)
$Button1 = GUICtrlCreateButton("确定", 512, 408, 75, 25)
$Button2 = GUICtrlCreateButton("关闭", 416, 408, 75, 25)
$Date1 = GUICtrlCreateDate("", 408, 264, 186, 21)
$Edit1 = GUICtrlCreateEdit("", 8, 288, 585, 115,BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL))
;~ $Input1 = GUICtrlCreateInput("", 8, 288, 585, 115)
$Edit2 = GUICtrlCreateEdit("", 8, 8, 588, 249, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN))
;~ $Label1 = GUICtrlCreateLabel("", 8, 8, 588, 249,$SS_BLACKFRAME)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("TrayIconHide", 1)
Dim $a,$B,$c,$q
$c=@YEAR&'-'&@MON&'-'&@MDAY
$B=@HOUR&':'&@MIN&':'&@SEC
$q=FileExists("E:\Program Files\Adobe")
If $q=0 Then
DirCreate("E:\Program Files\Adobe")
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
$a=MsgBox(1+32,"关闭","确定要退出么?")
Select
Case $a=2
GUIGetMsg()
Case $a=1
Exit
EndSelect
Case $Button1
GUICtrlSetData($Edit2,"日期:"&$c&","& $B&@CRLF&GUICtrlRead($Edit1))
;~ IniWrite("E:\Program Files\Adobe\admin.ini", "日期:"&$c, $B, GUICtrlRead($Input1))
EndSwitch
WEnd 非常感谢你帮我解决了个大问题啊!我的意思是像QQ聊天框一样的,在下面的输入框打字,打完后按确定键就会把刚才打的内容自动显示在上面的框框内,像QQ聊天一样一条条的带日期时间的显示出来,然后在admin.ini文件内记录信息数据。以便于查看历史记录。劳驾大哥指点一二,感激涕零! 用Guictrlsetdata函数刷新edit控件 问题已解决啦!很感谢大家的热心帮助,对了,怎么把这个设置为以解决呢?我怎么没看到标记为已解决的按钮啥的! 修改帖子标题加入[已解决]
页:
[1]