找回密码
 加入
搜索
查看: 3341|回复: 7

[AU3基础] 【已解决】 请求_GUICtrlIpAddress_Create设置灰色不可用!

  [复制链接]
发表于 2010-11-3 12:31:22 | 显示全部楼层 |阅读模式
本帖最后由 ssjoe 于 2010-11-5 00:16 编辑

各位大虾们能否帮忙解决一下这个问题:
一、IP框可否设置灰色不可用!
二、可否在IP框输入时把值自动显示在$Label2上?
#include <GuiConstants.au3>
#include <GuiIPAddress.au3>
Opt("GUIOnEventMode", 0)
$flag = ""
$Form1 = GUICreate("Form1", 494, 345, 192, 114)
$Label1 = GUICtrlCreateLabel("第一框:", 48, 64, 60, 28)
$Label2 = GUICtrlCreateLabel("IP框:", 48, 94, 60, 28)
$Input1 = GUICtrlCreateInput("", 128, 64, 169, 25)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 128, 94, 169, 25)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$IPAddress2 = _GUICtrlIpAddress_Create($Form1, 128, 124, 169, 25)
_GUICtrlIpAddress_Set($IPAddress2, "0.0.0.0")

GUISetState()


While 1

        $msg = GUIGetMsg()
        Switch $msg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-11-3 14:32:29 | 显示全部楼层
我想可能是这样:
设置灰色 GUICtrlSetStyle
自动显示GUICtrlSetData

评分

参与人数 1金钱 +15 收起 理由
afan + 15

查看全部评分

 楼主| 发表于 2010-11-3 22:01:11 | 显示全部楼层
谢谢您的帮忙 ,我测试了。但是不行。能不能帮我修改一下代码啊。。
发表于 2010-11-4 14:04:45 | 显示全部楼层
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>
Opt("GUIOnEventMode", 0)
$flag = ""
$Form1 = GUICreate("Form1", 494, 345, 192, 114)
$Label1 = GUICtrlCreateLabel("第一框:", 48, 64, 60, 28)
$Label2 = GUICtrlCreateLabel("IP框:", 48, 94, 60, 28)
$Input1 = GUICtrlCreateInput("", 128, 64, 169, 25)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 128, 94, 169, 25, $WS_DISABLED)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$IPAddress2 = _GUICtrlIpAddress_Create($Form1, 128, 124, 169, 25)
_GUICtrlIpAddress_Set($IPAddress2, "0.0.0.0")
GUISetState()

While 1
        dq()
        $msg = GUIGetMsg()
        Switch $msg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

Func dq()
        If _GUICtrlIpAddress_Get($IPAddress2) <> "0.0.0.0" Then
                _GUICtrlIpAddress_Set($IPAddress1, _GUICtrlIpAddress_Get($IPAddress2))
                GUICtrlSetData($Input1, _GUICtrlIpAddress_Get($IPAddress2))
        EndIf
EndFunc   ;==>dq

评分

参与人数 1金钱 +25 收起 理由
afan + 25

查看全部评分

 楼主| 发表于 2010-11-4 22:13:33 | 显示全部楼层
不是我要的效果,不过也谢谢你的帮忙,你以为可以用这样的方式来实现,但是测试了没成功!
不可用时变灰色
GUICtrlSetState($IPAddress1, $GUI_DISABLE)
可用时使用这样的
GUICtrlSetState($IPAddress1, $GUI_ENABLE)
Input框是可以,但IP框就无法实现。。。
发表于 2010-11-4 22:19:36 | 显示全部楼层
回复 5# ssjoe


    $IPAddress1 是句柄,GUICtrlSetState 只能使用 ID,不过对于这种组合控件有ID也不一定有用~ 没办法的话可以隐藏之,如果硬要灰色效果再弄个灰色的控件给它伪装下…
 楼主| 发表于 2010-11-5 00:12:29 | 显示全部楼层
噢。。。明白了,谢谢。。。
发表于 2011-2-12 12:44:36 | 显示全部楼层
好东西,学习
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 09:34 , Processed in 0.079497 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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