Sign in to follow this  
Followers 0
GaryFrost

Round Corners

14 posts in this topic

#1 ·  Posted (edited)

Thought some might be interested in this:

Test Script

#include <GuiConstants.au3>

$my_gui = GuiCreate("MyGUI", 392, 323)

_GuiRoundCorners($my_gui, 0, 0, 50, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Function to round the corners of a window:

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
   $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc  ;==>_GuiRoundCorners
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites



*Very cool*. I'm using this one already. Yet another useful function from gafrost :(.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Interesting. Some days ago, I was looking something like this, to work with regions, that it offers nice possibilities for windows.

Nice example. :(

Share this post


Link to post
Share on other sites

Wow cool :(

Next month we can maybe make something like this batman skin from mediaplayer :(


Sapiente vince, rex, noli vincere ferro!

Share this post


Link to post
Share on other sites

Wow cool  :(

Next month we can maybe make something like this batman skin from mediaplayer  :(

<{POST_SNAPBACK}>

I think you should be able to do that, based on gafrost's example. Just use multiple regions (using SetWindowRgn) until you get evreything that you want masked off. I haven't done this with AutoIt, but I remember writing a VB to do this a while back.

Share this post


Link to post
Share on other sites

When this is used it creates a different GUI style that doesn't look the same as XP theme. Is it possible to change this? I love this function and want to use really bad.

Thought some might be interested in this:

Test Script

#include <GuiConstants.au3>

$my_gui = GuiCreate("MyGUI", 392, 323)

_GuiRoundCorners($my_gui, 0, 0, 50, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;
    EndSelect
WEnd
Exit

Function to round the corners of a window:

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
   $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc  ;==>_GuiRoundCorners

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

When this is used it creates a different GUI style that doesn't look the same as XP theme. Is it possible to change this? I love this function and want to use really bad.

Very cool, if only someone made a UDF of all the possible GUI FX, I use user32.dll that does transitions. I don't know much about how to use dllcall but how do you guys find out what dll and how to call it.

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

ultracool - i love it, thanks 4 sharing!

Very nice, I´ll have to look at DLL Calls. That stuff seems to be very mighty. :)

So long,

Mega

Edited by th.meger

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

why is it in the Windows Classic Style?

Very cool UDF though


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

why is it in the Windows Classic Style?

Very cool UDF though

same for me.. but this is way cool! i hope there is possibility of completly chainging the interface.. csutom colors..

Share this post


Link to post
Share on other sites

I was able to round a normal window (the windows was SCiTE...) without making it Windows Classic style, so why is the gui in that style?


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

int SetWindowRgn(

HWND hWnd,

HRGN hRgn,

BOOL bRedraw

);

what do you use for hRgn?


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

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