找回密码
 加入
搜索
查看: 6805|回复: 12

[GUI管理] 【已解决】如何让控件信息刷新不闪屏?

  [复制链接]
发表于 2011-3-19 13:23:47 | 显示全部楼层 |阅读模式
本帖最后由 ac5474012 于 2011-3-20 10:40 编辑

用11楼的解决的闪烁的问题。

回复  ac5474012
水木子 发表于 2011-3-19 22:34


EndFunc[/code]身为GUI无的能的我,用户交互方面的东西表示压力很大。

我想做一个界面,在下面这两个输入框中输入的数字相同时点击确认就把这个数放到一个ini中,难点是我想让下面这个窗口显示这个ini中现在有的信息


ini文件的内容----------------------------
[数字]
1970/01/01 00:00:00=123456
---------------------------------------------
这两个输入框是用来验证的,也就是说这两个输入框中的数一致才能将这个数输入到ini的数值,而这个数值的关键字就是输入这个这个数的时间
时间是自动生成的,123456是输入的信息。另外这个ini要时常刷新,因为有另一个文件要时不时的删除这ini里面的内容。、

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2011-3-19 14:10:41 | 显示全部楼层
这很难吗?怎么没有人理我呢?还是太简单了... ...
发表于 2011-3-19 14:18:40 | 显示全部楼层
你说的啥同步显示?
 楼主| 发表于 2011-3-19 14:30:32 | 显示全部楼层
回复 3# xlcwxl

就是你输入一个信息在ini中,上面图片里那个界面就会在显示显示出你输入过的信息。
 楼主| 发表于 2011-3-19 15:06:30 | 显示全部楼层
... 很难吗?看来不学点界面制作是不行了,那位好心人给我来个例子的超链接也行啊。我这便是一点也不会 啊。
发表于 2011-3-19 15:34:08 | 显示全部楼层
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <array.au3>


Local $inifile = @DesktopDir & "\test.ini"

$Form1 = GUICreate("Form1", 433, 510, 192, 124)
$Input1 = GUICtrlCreateInput("", 56, 72, 137, 21)
$Input2 = GUICtrlCreateInput("", 56, 120, 137, 21)
$Button = GUICtrlCreateButton("确认", 224, 96, 75, 25)
$ListView = GUICtrlCreateListView("", 56, 216, 330, 254)
_GUICtrlListView_AddColumn($ListView, "关键字", 170)
_GUICtrlListView_AddColumn($ListView, "值", 150)

GUISetState(@SW_SHOW)

AdlibRegister("ini")

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button
                        IniWrite($inifile, "DATE", GUICtrlRead($Input1), GUICtrlRead($Input2))
                        GUICtrlSetData($Input1, "")
                        GUICtrlSetData($Input2, "")
        EndSwitch
        If GUICtrlRead($Input1) = "" And  GUICtrlRead($Input2) = ""  And BitAnd(GUICtrlGetState($Button), $GUI_DISABLE) = 0 Then
                GUICtrlSetState($Button, $GUI_DISABLE)
        ElseIf GUICtrlRead($Input1) <> "" And  GUICtrlRead($Input2) <> ""  And BitAnd(GUICtrlGetState($Button), $GUI_DISABLE) <> 0 Then
                GUICtrlSetState($Button, $GUI_ENABLE)
        EndIf
WEnd

Func ini()
        _GUICtrlListView_DeleteAllItems($ListView)
        $array = IniReadSection($inifile, "DATE")
        If @error Then
                GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
        Else
                For $i = 1 To $array[0][0]
                        GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $ListView)
                Next
        EndIf
EndFunc

评分

参与人数 1金钱 +25 贡献 +1 收起 理由
ac5474012 + 25 + 1 谢,但有几事不明

查看全部评分

 楼主| 发表于 2011-3-19 16:22:18 | 显示全部楼层
回复 6# yhxhappy

yhxhappy 发表于 2011-3-19 15:34


非常感谢。但是仍有几件事情要问下。
刚刚用了一下,可能我说的不清楚,这两个输入框是用来验证的,也就是说这两个输入框中的数一致才能将这个数输入到ini的数值,而这个数值的关键字就是输入这个这个数的时间

把 关键字 变成时间 和 校对上下框的信息,这两项我先看看能不能自己解决。但是还有一个问题是显示框刷新时老是一闪一闪的你能让它不闪了吗?
发表于 2011-3-19 16:42:56 | 显示全部楼层
回复 7# ac5474012


    你说的两个框数一致再写入INI文件可以实现,你自己先想想吧,不明白再问。
   可以不闪的,但实现起来有些复杂。
 楼主| 发表于 2011-3-19 17:06:48 | 显示全部楼层
回复 8# yhxhappy

回复  ac5474012


    你说的两个框数一致再写入INI文件可以实现,你自己先想想吧,不明白再问。
    ...
yhxhappy 发表于 2011-3-19 16:42


时间和校对是搞定了,但是闪闪的太不给力了。还是来个连接把。
这个我小改了一下的结果
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <array.au3>
#Include <date.au3>

Local $inifile = @ScriptDir & "\id.ini"

$Form1 = GUICreate("Form1", 433, 510, 192, 124)
$Input1 = GUICtrlCreateInput("1", 56, 72, 137, 21)
$Input2 = GUICtrlCreateInput("2", 56, 120, 137, 21)
$Button = GUICtrlCreateButton("确认", 224, 96, 75, 25)
$ListView = GUICtrlCreateListView("", 56, 216, 330, 254)
_GUICtrlListView_AddColumn($ListView, "时间", 170)
_GUICtrlListView_AddColumn($ListView, "ID号", 150)

GUISetState(@SW_SHOW)

AdlibRegister("ini",5000)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                                        Case $Button
                                                MsgBox(0,GUICtrlRead($Input1),GUICtrlRead($Input2))
                                                If GUICtrlRead($Input1) = GUICtrlRead($Input2) Then 
                        IniWrite($inifile, "全部",_NowCalc() , GUICtrlRead($Input2))
                        GUICtrlSetData($Input1, "")
                        GUICtrlSetData($Input2, "")
                                        ElseIf GUICtrlRead($Input1) <> GUICtrlRead($Input2) Then 
                                                MsgBox(0,"错误","两次ID号不相同")
                                                Else
                                                        MsgBox(0,"意外错误", "请与程序管理员联系")
                                                EndIf        
        EndSwitch
        If GUICtrlRead($Input1) = "" And  GUICtrlRead($Input2) = ""  And BitAnd(GUICtrlGetState($Button), $GUI_DISABLE) = 0 Then
                GUICtrlSetState($Button, $GUI_DISABLE)
        ElseIf GUICtrlRead($Input1) <> "" And  GUICtrlRead($Input2) <> ""  And BitAnd(GUICtrlGetState($Button), $GUI_DISABLE) <> 0 Then
                GUICtrlSetState($Button, $GUI_ENABLE)
        EndIf
WEnd

Func ini()
        _GUICtrlListView_DeleteAllItems($ListView)
        $array = IniReadSection($inifile, "全部")
        If @error Then
                GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
        Else
                For $i = 1 To $array[0][0]
                        GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $ListView)
                Next
        EndIf
EndFunc
发表于 2011-3-19 21:41:58 | 显示全部楼层
我也想知道。怎么样才能不闪。。
发表于 2011-3-19 22:34:45 | 显示全部楼层
回复 7# ac5474012

#include <date.au3>
#include <GuiListView.au3>
Global $inifile = @ScriptDir & "\id.ini"

$Form1 = GUICreate("Form1", 433, 510)
$Input1 = GUICtrlCreateInput("1", 56, 72, 137, 21)
$Input2 = GUICtrlCreateInput("2", 56, 120, 137, 21)
$Button = GUICtrlCreateButton("确认", 224, 96, 75, 25)
$ListView = GUICtrlCreateListView("", 56, 216, 330, 254)
_GUICtrlListView_AddColumn($ListView, "时间", 170)
_GUICtrlListView_AddColumn($ListView, "ID号", 150)
Ini()
GUISetState()

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit
                Case $Button
                        $sText1 = GUICtrlRead($Input1)
                        $sText2 = GUICtrlRead($Input2)
                        If $sText1 <> '' Or $sText2 <> '' Then
                                If $sText1 = $sText2 Then
                                        GUICtrlCreateListViewItem(_NowCalc() & '|' & $sText1, $ListView)
                                        IniWrite($inifile, "全部",_NowCalc() ,  $sText1)
                                EndIf
                        EndIf
        EndSwitch
WEnd

Func ini()
        ;_GUICtrlListView_DeleteAllItems($ListView)
        $array = IniReadSection($inifile, "全部")
        If @error Then
                GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
        Else
                For $i = 1 To $array[0][0]
                        GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $ListView)
                Next
        EndIf
EndFunc   ;==>ini

评分

参与人数 1金钱 +25 贡献 +5 收起 理由
ac5474012 + 25 + 5 不闪的不伤眼睛的

查看全部评分

发表于 2011-4-24 11:07:27 | 显示全部楼层
学习了啊啊 啊
发表于 2011-4-24 11:08:03 | 显示全部楼层
又来学习了啊
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-3 00:41 , Processed in 0.117826 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表