找回密码
 加入
搜索
查看: 3335|回复: 5

[GUI管理] 点击鼠标左键打开相应的地址,如何实现

  [复制链接]
发表于 2010-10-5 11:09:36 | 显示全部楼层 |阅读模式
我在程序里添加个label标签,设置鼠标移到上面为手的形状。
我想点击鼠标左键能够打开相应的文档。达到像IE中超级链接效果
本人刚刚学,想了很久。用GUICtrlGetState取得状态在执行,怎么都想不出好方法。
请大侠给个指点。谢谢!


$Label1 = GUICtrlCreateLabel("使用说明文件", 610, 50, 180, 20)
GUICtrlSetCursor (-1, 0)
发表于 2010-10-5 18:57:47 | 显示全部楼层
循环中设置
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Label1
                        ShellExecute("D:\help.chm")

        EndSwitch
WEnd


希望能够有所帮助~
发表于 2010-10-5 21:55:37 | 显示全部楼层
本帖最后由 xyold1 于 2010-10-5 21:56 编辑

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 200, 84, 192, 124)
$Label1 = GUICtrlCreateLabel("使用说明文件", 48, 24, 76, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Label1
                        ShellExecute("D:\")
        EndSwitch
WEnd


不知这么做对 不对
发表于 2010-10-5 22:14:21 | 显示全部楼层
不知这么做对 不对
xyold1 发表于 2010-10-5 21:55



    #include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 200, 84, 192, 124)
$Label1 = GUICtrlCreateLabel("使用说明文件", 48, 24, 76, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Label1
                        FileOpenDialog("要打开的文件","","所有文件(*.*)")
        EndSwitch
WEnd
发表于 2010-10-5 22:20:47 | 显示全部楼层
回复 4# liufenglg

谢谢指出错误
发表于 2010-10-6 12:49:45 | 显示全部楼层
回复 4# liufenglg


    楼主只需要打开特定文件 效果是“达到像IE中超级链接效果”

应该不需要做文件浏览对话框吧?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-20 20:38 , Processed in 0.085033 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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