Jump to content

Recommended Posts

Posted

I created this in less than an hour. It has a few lines of code to use it in your scripts/compiled scripts. Allows skinning of the GUI using bitmaps.

Features:

:Using bitmap images to customize how the window look like

:Can add more buttons(help,etc)

:Auto lock to edge of screen so window can't move beyond the screen

Problems:

:Cannot use rounded corners(like XP's luna interface)

:When minimize and restores,buttons are lost. Just hover the cursor on them to restore them back.

:a bit untidy code.

Give it a try and i will improve it in due time. Thanks.

My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]
Posted (edited)

Very Nice. There have been some other GUI skinning but I think this is the best one :(.

To solve the problem about the buttons disappearing simply swap the order in which you create the items and use a style. This works fine :(...

#include <GUIConstants.au3>
$main_gui=GUICreate ("Your App",320,200,-1,-1,$WS_POPUPWINDOW)
;"Your App" defines the title of the GUI form.

$menubar=GUICtrlCreatePic ("menu_bar.bmp",0,0,320,24, 0x00000020)
$button_close=GUICtrlCreateButton("",290,0,24,24,0x0080)
GUICtrlSetImage ($button_close,"menu_close.bmp")
$button_min=GUICtrlCreateButton("",260,0,24,24,0x0080)
GUICtrlSetImage ($button_min,"menu_min.bmp")
GUICtrlCreatePic ("menu_down.bmp",0,195,320,5)
GUICtrlCreatePic ("menu_sides.bmp",0,24,4,200)
GUICtrlCreatePic ("menu_sides.bmp",316,24,4,200)
GUICtrlSetTip ($button_close,"Closes the application")
GUICtrlSetTip ($button_min,"Minimizes the application")
GUICtrlSetTip ($menubar,"Hold the primary mouse button to drag the window.")
GUISetState(@SW_SHOW)

And every thing else is the same. I moved the GUISetState() and changed the style for $menubar=GUICtrlCreatePic ("menu_bar.bmp",0,0,320,24, 0x00000020)

Hint: When creating things that over lap such as having a background for your GUI start with what will be on the bottom first, then whats on top of that, and then whats on top of that etc. And you should always call GUISetState() after you have created/altered all your controls.

Edit: Also what program did you use to create the support pictures and I think you need to do some work for the window moving.

Edit 2: Ok I fixed the window moving by using a funciton created by SlimShady. I also fixed the indentations and changed the order of creating the controls a little bit.

Edited by Burrup

qq

Posted (edited)

Burrup:

Thanks,burrup! The GUI is much more stable now!

I used MS-Paint to create the Bitmaps. I will add more features in due time.

Thanks again.

Note:

If you want to use the source in your scripts,please download the first post's ZIP file for the skin bitmaps and burrup's modified basic_skin.au3.

Plans:

To add rounded corners (if at all possible)

Transparency setting (in 2K/XP)

Better looking 3D-like skins

Dynamically resizing GUI form

Edited by Mcky
My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]
Posted (edited)

Here is a new skins pack. See the screenshot:

Includes modified script by Burrup

Edited by Mcky
My website: (Lots of AutoIt compiled programs+GameMaker games)http://mcky.sitesled.comMy AutoIt projects:Mcky's CalEntry - Calendar schedulingMcky's Web Extractor - Web page links extractorMcky's Appkey- Powerful Hotkey-listing tool[quote]I wish I was never born. I am just a lonely soul in this world... :([/quote]
Posted

Nice. I'm working on a little skinning idea as well mostly using Adobe PhotoShop CS, ImageReady CS and PhotoShop Elements because you can create real nice images with them.

qq

Posted (edited)

They can be a hassle to implement lol, currently I'm trying to work with the new window shape functions gafrost provided and using transparent gif's. But it gets a bit hard with a transparent picture because of child windows etc etc.

Edited by Burrup

qq

  • 2 months later...
Posted

I see that u have forgotten to use an extended style in your skin script. In basic_skin.au3 if you use :

$menubar=GUICtrlCreatePic ("menu_bar.bmp",0,0,320,24,-1,$GUI_WS_EX_PARENTDRAG)

instead of :

$menubar=GUICtrlCreatePic ("menu_bar.bmp",0,0,320,24)

Then you will have a smooth window movement and without having to play with MouseGetCursor().

$main_gui=GUICreate ("Your App",320,200,-1,-1,$WS_POPUPWINDOW)
;"Your App" defines the title of the GUI form.
GUISetState(@SW_SHOW)
$button_close=GUICtrlCreateButton("",290,0,24,24,0x0080)
GUICtrlSetImage ($button_close,"menu_close.bmp")
$button_min=GUICtrlCreateButton("",260,0,24,24,0x0080)
GUICtrlSetImage ($button_min,"menu_min.bmp")
$menubar=GUICtrlCreatePic ("menu_bar.bmp",0,0,320,24,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreatePic ("menu_down.bmp",0,195,320,5)
GUICtrlCreatePic ("menu_sides.bmp",0,24,4,200)
GUICtrlCreatePic ("menu_sides.bmp",316,24,4,200)
GUICtrlSetTip ($button_close,"Closes the application")
GUICtrlSetTip ($button_min,"Minimizes the application")
GUICtrlSetTip ($menubar,"Hold the primary mouse button to drag the window.")



While 1
$msg = GUIGetMsg()
If $msg=$button_close Then Exit
If $msg=$button_min Then WinSetState("Your App","",@SW_MINIMIZE)
;~ $mouse_data=GUIGetCursorInfo ($main_gui)
;~ If $mouse_data[2]=1 AND $mouse_data[4]=$menubar Then GUI_POS()
Wend


;~ Func GUI_POS()

;~ While 1
;~ $mouse_data=GUIGetCursorInfo ($main_gui)
;~ If $mouse_data[2]=0 Then 
;~ $mpos=MouseGetPos ( )
;~ ExitLoop
;~ EndIf
;~ Wend

;~;these two values:320 and 200,corresponds to the size of GUI form. Change according to the size of your GUI.
;~ If $mpos[0]>@DesktopWidth-320 Then $mpos[0]=@DesktopWidth-320
;~ If $mpos[1]>@DesktopHeight-200 Then $mpos[1]=@DesktopHeight-200
;~ WinMove ("Your App","",$mpos[0],$mpos[1])

;~ EndFunc

C ya

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
  • Recently Browsing   0 members

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