Jump to content

shaping a button


Recommended Posts

can you shape a button, i know you can shape a GUI, but have no clue on shaping a button, and if you can't well i guess that will be a new project for me with the help of larrys script :D

[s]Autoit[/s]
Link to comment
Share on other sites

HI,

what do you exactly mean with shape? There are so many translations. :">

You can set a pic on it to make it look better.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

to carve it in to squares or circles or w/e, but doesn't adding a picture cut in out in to that shape or was that icons hmm?

-so i guess nobody made something like this

Edited by Vicks
[s]Autoit[/s]
Link to comment
Share on other sites

What I have done before is to use GuiCtrlCreatePic() not a button, then in the $Msg= loop look for the image being clicked, then have an while _ispressed (left mouse button) swap the image to a picture with shading that looks pressed. Then swap it back to the not pressed image on mouse up.

Link to comment
Share on other sites

Here is what you're looking for, but the control gets redrawn for some reason. Gafrost or someone may know how to make it work.

#include <GUIConstants.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Button_1 = GuiCtrlCreateButton("Button1", 70, 60, 150, 80)

GuiSetState()

;_ControlToRoundedRectangle($Button_1,0,0,40,80,10,10)
_ControlToEllipse($Button_1,90,90)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Button_1
        MsgBox(0,"Testing","You Clicked It!")    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd

Func _ControlToRoundedRectangle($aControl,$X1,$Y1,$X2,$Y2,$X3,$Y3)
    Local $l
    Local $handle = GUICtrlGetHandle($aControl)
    $l = DllCall("gdi32.dll","int","CreateRoundRectRgn","int",$X1,"int",$Y1,"int",$X2,"int",$Y2,"int",$X3,"int",$Y3)
    DllCall("user32.dll","int","SetWindowRgn","hwnd",$handle,"int",$l[0],"int",True)
EndFunc

Func _ControlToEllipse($aControl,$width,$height)
    Local $l
    Local $handle = GUICtrlGetHandle($aControl)
    $l = DllCall("gdi32.dll","int","CreateEllipticRgn","int",0,"int",0,"int",$width,"int",$height)
    DllCall("user32.dll","int","SetWindowRgn","hwnd",$handle,"int",$l[0],"int",1)
EndFunc
Link to comment
Share on other sites

Here is what you're looking for, but the control gets redrawn for some reason. Gafrost or someone may know how to make it work.

#include <GUIConstants.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Button_1 = GuiCtrlCreateButton("Button1", 70, 60, 150, 80)

GuiSetState()

;_ControlToRoundedRectangle($Button_1,0,0,40,80,10,10)
_ControlToEllipse($Button_1,90,90)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Button_1
        MsgBox(0,"Testing","You Clicked It!")    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd

Func _ControlToRoundedRectangle($aControl,$X1,$Y1,$X2,$Y2,$X3,$Y3)
    Local $l
    Local $handle = GUICtrlGetHandle($aControl)
    $l = DllCall("gdi32.dll","int","CreateRoundRectRgn","int",$X1,"int",$Y1,"int",$X2,"int",$Y2,"int",$X3,"int",$Y3)
    DllCall("user32.dll","int","SetWindowRgn","hwnd",$handle,"int",$l[0],"int",True)
EndFunc

Func _ControlToEllipse($aControl,$width,$height)
    Local $l
    Local $handle = GUICtrlGetHandle($aControl)
    $l = DllCall("gdi32.dll","int","CreateEllipticRgn","int",0,"int",0,"int",$width,"int",$height)
    DllCall("user32.dll","int","SetWindowRgn","hwnd",$handle,"int",$l[0],"int",1)
EndFunc
wow thanks just what i needed, now i hope gafrost or some other GUI wizard helps unless i figure it out, which won't happen because im going to my cottage for the rest of the weekend, another thing if you don't mind how did you make this wonderful example, just pure skills? Edited by Vicks
[s]Autoit[/s]
Link to comment
Share on other sites

Check my sig for a way to do this without flickering. Lots of examples too :D

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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...