Jump to content

How to Create This Button


Recommended Posts

I Need Update this Script and make it please look like image

This Script :

; By : Microsoft.com
#include <GUIConstants.au3>
$Form1 = GUICreate("Microsoft @2007", 652, 456, 291, 183)
Global $MODE = 2  
Global $INITDRAW = 0, $DRAWING = 1, $INITMOVE = 2, $MOVING = 3, $INITRESIZE = 4, $RESIZING = 5
Global $currentCtrl, $currentType, $p, $lock, $prevX, $prevY, $cursorInfo, $hover, $numCtrls, $grippyCtrl
Global $copiedWidth = 0, $copiedHeight = 0
Global $MCL[4097][2]
Global $lock = 0 
Global $N = 21
Global $type[$N+1]
$tip = StringSplit("Cursor|Tab|Group|Button|Checkbox|Radio|Edit|Input|Label|UpDown|List|Combo|Date|Treeview|Progress

|Avi|Icon|Pic|Menu|ContextMenu|Slider", "|")
$notYetImplemented = ",2,10,16,19,20,"
For $row = 0 to 6
   For $col = 0 to 2
      $i = 3*$row + $col + 1 
      $type[$i] = GUICtrlCreateRadio("foo", $col*50, $row*50, 50, 50, 0x1040)
      GUICtrlSetTip(-1, $tip[$i])
      GUICtrlSetImage(-1, @ProgramFilesDir & "\AutoIt3\SciTE\GUIBuilder\iconSet.icl", $i)
      If StringInStr($notYetImplemented, "," &  $i & ",") Then GuiCtrlSetState($type[$i], $GUI_DISABLE)
      Next
  Next
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

This Image Example

Posted Image

i'm waiting your help,please.

Link to comment
Share on other sites

I Need Update this Script and make it please look like image

I think that to do this in Autoit is a little long-winded compared to Delphi say.

But the method I would apply is shown in the script below. Of course there is bound to be a better way.

You need 3 images. One for not pressed, one for mouse over and one for pressed. The images I've chosen are just to show the idea.

#include <GUIConstants.au3>
#include <constants.au3>
Global $Pic[4]
Dim $Info[4] = [0,0,0,0]
Global $show
$Form1 = GUICreate("Microsoft @2007", 652, 456, 291, 183)
$Pic[1] = GUICtrlCreateIcon ("shell32.dll",10, 20,20)
$Pic[2] = GUICtrlCreateIcon ("shell32.dll",11, 20,20)
$Pic[3] = GUICtrlCreateIcon ("shell32.dll",12, 20,20)

GUISetState()

setnow(1)



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic[2]
            If $Info[4] = $Pic[2] Then
                setnow(3)
            EndIf
        Case $Pic[3]
            setnow(2)
            

    EndSwitch
    
    
    $Info =  GUIGetCursorInfo ($Form1)
    If $Info[4] = $Pic[1]   Then
        setnow(2)
    ElseIf $show = 2 And $Info[4] <> $Pic[2] Then
        setnow(1)
    EndIf
    
WEnd

Func setnow($p1)
    $show = $p1
    $b = Mod($p1,3) + 1
    $c = Mod($p1 + 1,3) + 1
    GUICtrlSetState($Pic[$p1],$GUI_SHOW)
    GUICtrlSetState($Pic[$b],$GUI_HIDE)
    GUICtrlSetState($Pic[$c],$GUI_HIDE)
EndFunc

EDIT: Simplified the code a bit and added Case $Pic[3]

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...