Jump to content

Howto make button like XP


Xink
 Share

Recommended Posts

Hi,

I want to make a button like xp style, flat button and when you move your mouse over the button, it must highlight and show the button edges.

Same as button in xp explorer.

CODE
#include <GUIConstants.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered

GUICtrlCreateButton("Test", 20, 20, 60, 40, BitOR($BS_PUSHBOX,$BS_FLAT))

GUISetState (@SW_SHOW) ; will display an empty dialog box

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

Link to comment
Share on other sites

but if you have winxp, the buttons are already xp style (or you must use classic style)

Please compare the button in this script with the button on XP in explorer.

The button in this script has a border around. Button in explorer (for example: search button) has no border, and when you move the mouse over it, it highlight this button.

Xink

edit: i use the default skin of XP and not classic mode

Edited by Xink
Link to comment
Share on other sites

Hi,

An ass about way of sort of getting the effect, but I couldn't work out how to remove the black border on a button when it's highlighted..

#include <GUIConstants.au3>

Global $State, $Click

$Gui = GUICreate("My GUI")
GUISetBkColor(0xEFEEE1)
$Label = GUICtrlCreateLabel("Test", 20, 20, 60, 40, $SS_CENTER + $BS_CENTER)
GUICtrlSetColor(-1, 0x000000)
$Button = GUICtrlCreateButton("Test", 20, 20, 60, 40)
GUICtrlSetBkColor(-1, 0xF8F8F4)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState (@SW_SHOW) 

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    ButtonFX()
Wend

Func ButtonFX()
    $GGCI = GUIGetCursorInfo($Gui)
    If $GGCI[4] = $Label And $State = 0 Then
        GUICtrlSetState($Button, $GUI_SHOW)
        $State = 1
    ElseIf $GGCI[4] = $Button And $GGCI[2] = 1 And $Click = 0 Then
        GUICtrlSetBkColor($Button, 0xE5E4DD)
        GUICtrlSetColor($Button, 0xffffff)
        $Click = 1
    ElseIf $GGCI[4] = $Button And $GGCI[2] = 0 And $Click = 1 Then
        GUICtrlSetBkColor($Button, 0xF8F8F4)
        GUICtrlSetColor($Button, 0x000000)
        $Click = 0
    ElseIf $GGCI[4] <> $Label And $GGCI[4] <> $Button And $State = 1 Or $State = 2 Then
        $State = 0
        GUICtrlSetState($Button, $GUI_HIDE)
    EndIf   
EndFunc

Cheers

Link to comment
Share on other sites

It's a toolbar I think. Someone made a few UDFs in Example Scripts

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
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...