Sign in to follow this  
Followers 0
Vicks

shaping a button

9 posts in this topic

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]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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]

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites

I made it by searching VB forums, this AutoIt forum, and stealing borrowing code. :D

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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