Sign in to follow this  
Followers 0
taotao878

How to create this HyperLinks ?

6 posts in this topic

How do I create this HyperLink ?

Please look the attachment.

post-24544-1203926301_thumb.gif

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

#include <GUIConstants.au3>

Global $Last

$Gui = GUICreate(":)", 120, 50)
$Label = GUICtrlCreateLabel("Version, Blah, Blah" & @LF & "Technical: Yada, Yada", 5, 5, 110, 25)
GUICtrlSetColor(-1, 0x0000FF)
$Link = GUICtrlCreateLabel("www.autoitscript.com", 5, 30, 110, 15)
GUICtrlSetColor(-1, 0x0000FF)
GUISetState(@SW_SHOW, $Gui)

While 1
    
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Link
            ShellExecute(GUICtrlRead($Link))
        Case Else
            $GGCI = GUIGetCursorInfo($Gui)
            If $GGCI[4] = $Link And $Last <> $Link  Then  
                GUICtrlSetFont($Link, Default, Default, 6)
                $Last = $Link
            ElseIf $GGCI[4] <> $Link And $Last = $Link Then 
                GUICtrlSetFont($Link, Default, Default, Default)
                $Last = 0
            EndIf   
    EndSwitch
WEnd

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

More examples:

#include <GuiConstants.au3>

Global $aCurPos[5]
Dim $Flag = 1

$hGui = GuiCreate("Main GUI", 300, 200)

$Menu1 = GUICtrlCreateMenu("&File")

$Menu2 = GUICtrlCreateMenu("&Options")

$Menu3 = GUICtrlCreateMenu("&Help")
$Item1 = GUICtrlCreateMenuItem("User manual", $Menu3)
$Item2 = GUICtrlCreateMenuItem("About", $Menu3)

;About child GUI
$AboutGUI = GUICreate("About...", 200, 100, -1, -1, -1, $WS_EX_TOOLWINDOW, $hGui)

GUICtrlCreateLabel("Version 1.0 (Build 12)" & @CRLF & _
"Technical support: support@zhangduo.com", 40, 10, 120, 40)

$URL_Label = GUICtrlCreateLabel("Website: http://drv.n3.net", 40, 55, 140, 15)
GUICtrlSetCursor(-1, 0)

GUISetState(@SW_SHOW, $hGui)

While 1
    $msg = GUIGetMsg(1)
    $aCurPos = GUIGetCursorInfo($AboutGUI)
    
    If $aCurPos[4] = $URL_Label And $Flag = 1 Then
        GUICtrlSetFont($URL_Label, Default, 400, 2)
        GUICtrlSetColor($URL_Label, 0xFF0000)
        $Flag = 0
    ElseIf $aCurPos[4] <> $URL_Label And $Flag = 0 Then
        GUICtrlSetFont($URL_Label, Default, 400, 1)
        GUICtrlSetColor($URL_Label, 0x000000)
        $Flag = 1
    EndIf
    
    Select
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $hGui
        ExitLoop
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $AboutGUI
        GUISetState(@SW_ENABLE, $hGui)
        GUISetState(@SW_HIDE, $AboutGUI)
    Case $msg[0] = $Item2
        GUISetState(@SW_DISABLE, $hGui)
        GUISetState(@SW_SHOW, $AboutGUI)
    Case $msg[0] = $URL_Label
        $url = StringRegExp(GUICtrlRead($URL_Label), "http.*", 1)
        ShellExecute($url[0])
    EndSelect
WEnd
:)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks! But if I use "OnEvent" Mode, How do I ?

Edited by taotao878

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Global $Last

$Gui = GUICreate(":)", 120, 50)
$Label = GUICtrlCreateLabel("Version, Blah, Blah" & @LF & "Technical: Yada, Yada", 5, 5, 110, 25)
GUICtrlSetColor(-1, 0x0000FF)
$Link = GUICtrlCreateLabel("www.autoitscript.com", 5, 30, 110, 15)
GUICtrlSetOnEvent(-1, "Event")
GUICtrlSetColor(-1, 0x0000FF)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui)
GUISetState(@SW_SHOW, $Gui)

While 1
    Sleep(100)
    $GGCI = GUIGetCursorInfo($Gui)
    If $GGCI[4] = $Link And $Last <> $Link  Then ;  
        GUICtrlSetFont($Link, Default, Default, 6)
        $Last = $Link
    ElseIf $GGCI[4] <> $Link And $Last = $Link Then 
        GUICtrlSetFont($Link, Default, Default, Default)
        $Last = 0
    EndIf
WEnd

Func Event()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Link
            ShellExecute(GUICtrlRead($Link))
    EndSwitch
EndFuncoÝ÷ ØêÚºÚ"µÍÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÜ
    ][ÝÑÕRSÛ][[ÙI][ÝËJBÛØ[ ÌÍÓÝÌÍÑÝZHHÕRPÜX]J    ][ÝÎI][ÝËL
L
BÌÍÓX[HÕRPÝÜX]SX[
    ][ÝÕÚ[ÛZZ   ][ÝÈ  [È [È ][ÝÕXÚXØ[XYKXYI][ÝË
K
KLLJBÕRPÝÙ]ÛÛÜLKBÌÍÓ[ÈHÕRPÝÜX]SX[
    ][ÝÝÝÝË]]Ú]ØÜÛÛI][ÝË
KÌLLMJBÕRPÝÙ]Û][
LK  ][ÝÑ][    ][ÝÊBÕRPÝÙ]ÛÛÜLKBÕRTÙ]Û][
    ÌÍÑÕRWÑUSÐÓÔÑK ][ÝÑ][    ][ÝË  ÌÍÑÝZJBÕRTÙ]Ý]JÕ×ÔÒÕË  ÌÍÑÝZJBYX[XJ    ][ÝÓ[ÝÙSÝ][ÝËL
BÚ[HBTÛY
L
BÑ[[È[ÝÙSÝ
BIÌÍÑÑÐÒHHÕRQÙ]ÝÛÜ[Ê    ÌÍÑÝZJBRY   ÌÍÑÑÐÒVÍHH   ÌÍÓ[È[  ÌÍÓÝ    ÉÝÈ  ÌÍÓ[È[ÈBQÕRPÝÙ]Û
    ÌÍÓ[ËY][Y][
BBIÌÍÓÝH    ÌÍÓ[ÂQ[ÙRY ÌÍÑÑÐÒVÍH    ÉÝÈ  ÌÍÓ[È[  ÌÍÓÝH   ÌÍÓ[È[BBQÕRPÝÙ]Û
    ÌÍÓ[ËY][Y][Y][
BBIÌÍÓÝHQ[Y[[Â[È][

BTÝÚ]ÚÕRWÐÝYBPØÙH   ÌÍÑÕRWÑUSÐÓÔÑBBBQ^]BPØÙH ÌÍÓ[ÂBBTÚ[^XÝ]JÕRPÝXY
    ÌÍÓ[ÊJBQ[ÝÚ]Ú[[

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

Thank you very much !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0