Yashied Posted January 3, 2015 Posted January 3, 2015 (edited) LAST VERSION - 0.203-Jan-15Skin UDF allows you to create buttons from the predefined images (files, resources, etc.). I rewrote this library by using GDI+ (first version used GDI). This allowed add the many additional features and get rid of the problems related to the transparency. Nevertheless, the library has a beta status, so there is no detailed description of the functions. But I am sure that the example below gives complete information about the features of this library. I hope that many users will find it useful. If you will have any questions, please ask them in this thread. Available functions_Skin_AddButton_Skin_AddButtonEx_Skin_DeleteButton_Skin_Destroy_Skin_DisableButton_Skin_EnableFocus_Skin_EnableKBInput_Skin_Helper_Skin_SetButton_Skin_SetButtonEx_Skin_SetFocusRectSkin Library v1.0Skin.zipExampleexpandcollapse popup#Include <GUIConstantsEx.au3> #Include <Skin.au3> Global $Button[3] $hForm = GUICreate('MyGUI', 278, 106) GUICtrlCreatePic('background.bmp', 0, 0, 278, 106) GUICtrlSetState(-1, $GUI_DISABLE) ; Create buttons from PNG images (images should be located in the same folder as the script) $Button[0] = _Skin_AddButton(20 , 20, 66, 66, 'red_normal.png', 'red_hover.png', 'red_click.png', 'disable.png', 'alpha.png', 1) $Button[1] = _Skin_AddButton(106, 20, 66, 66, 'yellow_normal.png', 'yellow_hover.png', 'yellow_click.png', 'disable.png', 'alpha.png', 1) $Button[2] = _Skin_AddButton(192, 20, 66, 66, 'green_normal.png', 'green_hover.png', 'green_click.png', 'disable.png', 'alpha.png', 1) #cs ; Create buttons from GDI+ HBITMAP handles $Button[0] = _Skin_AddButtonEx(20 , 20, 64, 64, _GDIPlus_BitmapCreateFromFile('red_normal.png'), ..., 1, 1) $Button[1] = _Skin_AddButtonEx(104, 20, 64, 64, _GDIPlus_BitmapCreateFromFile('yellow_normal.png'), ..., 1, 1) $Button[2] = _Skin_AddButtonEx(188, 20, 64, 64, _GDIPlus_BitmapCreateFromFile('green_normal.png'), ..., 1, 1) #ce ; Disable "Yellow" button (Optional) _Skin_DisableButton($Button[1], 1) ; Enable keyboard input (Optional) _Skin_EnableKBInput(1) ; Set margins for dotted focus rectangle (Optional) For $i = 0 To 2 _Skin_SetFocusRect($Button[$i], 5, 5, 56, 56) Next ; Enable dotted focus rectangle (Optional) _Skin_EnableFocus(1) GUISetState() ; _Skin_Helper() must be called continuously in the main loop While 1 _Skin_Helper($hForm) $ID = GUIGetMsg() Switch $ID Case 0 ContinueLoop Case $GUI_EVENT_CLOSE ExitLoop Case $Button[0] ConsoleWrite('Red' & @CR) Case $Button[1] ConsoleWrite('Yellow' & @CR) Case $Button[2] ConsoleWrite('Green' & @CR) Case Else EndSwitch WEnd ; You must delete all created buttons before destroying the appropriate window ;~For $i = 0 To 2 ;~ _Skin_DeleteButton($Button[$i]) ;~Next Edited December 6, 2015 by Yashied mihelson83, Biatu and mesale0077 3 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Guest Posted January 3, 2015 Posted January 3, 2015 (edited) Thank you!This is exactly what I was looking for. Excellent projectYou came just at the right time in perfect accuracy Edit: I need it to work with embedded images with Resources UDF I would love if you add such support Edit2: My request is valid if you did not added such support ..I'll check the UDF in more detail later.. Edited January 3, 2015 by Guest
Yashied Posted January 6, 2015 Author Posted January 6, 2015 I need it to work with embedded images with Resources UDFAll you need is a _Skin_AddButtonEx() function. Here's an example:expandcollapse popup#Region Resources #AutoIt3Wrapper_Res_File_Add=background.bmp, 2, 200 #AutoIt3Wrapper_Res_File_Add=red_normal.png, PNG, RED_NORMAL #AutoIt3Wrapper_Res_File_Add=red_hover.png, PNG, RED_HOVER #AutoIt3Wrapper_Res_File_Add=red_click.png, PNG, RED_CLICK #AutoIt3Wrapper_Res_File_Add=yellow_normal.png, PNG, YELLOW_NORMAL #AutoIt3Wrapper_Res_File_Add=yellow_hover.png, PNG, YELLOW_HOVER #AutoIt3Wrapper_Res_File_Add=yellow_click.png, PNG, YELLOW_CLICK #AutoIt3Wrapper_Res_File_Add=green_normal.png, PNG, GREEN_NORMAL #AutoIt3Wrapper_Res_File_Add=green_hover.png, PNG, GREEN_HOVER #AutoIt3Wrapper_Res_File_Add=green_click.png, PNG, GREEN_CLICK #AutoIt3Wrapper_Res_File_Add=alpha.png, PNG, ALPHA #EndRegion Resources #Include <GDIPlus.au3> #Include <GUIConstantsEx.au3> #Include <Memory.au3> #Include <Skin.au3> #Include <WinAPIEx.au3> Global $hInstance = _WinAPI_GetModuleHandle('') Global $hBitmap[10] = ['RED_NORMAL', 'RED_HOVER', 'RED_CLICK', 'YELLOW_NORMAL', 'YELLOW_HOVER', 'YELLOW_CLICK', 'GREEN_NORMAL', 'GREEN_HOVER', 'GREEN_CLICK', 'ALPHA'] Global $Button[3] _GDIPlus_Startup() For $i = 0 To 9 $hBitmap[$i] = _LoadResourceImage($hInstance, 'PNG', $hBitmap[$i]) Next _GDIPlus_Shutdown() $hForm = GUICreate('MyGUI', 278, 106) GUICtrlCreatePic('', 0, 0, 278, 106) GUICtrlSendMsg(-1, 0x0172, 0, _WinAPI_LoadBitmap($hInstance, 200)) GUICtrlSetState(-1, $GUI_DISABLE) $Button[0] = _Skin_AddButtonEx(20 , 20, 66, 66, $hBitmap[0], $hBitmap[1], $hBitmap[2], 0, $hBitmap[9], 1) $Button[1] = _Skin_AddButtonEx(106, 20, 66, 66, $hBitmap[3], $hBitmap[4], $hBitmap[5], 0, $hBitmap[9], 1) $Button[2] = _Skin_AddButtonEx(192, 20, 66, 66, $hBitmap[6], $hBitmap[7], $hBitmap[8], 0, $hBitmap[9], 1) _Skin_EnableKBInput(1) For $i = 0 To 2 _Skin_SetFocusRect($Button[$i], 5, 5, 56, 56) Next _Skin_EnableFocus(1) GUISetState() While 1 _Skin_Helper($hForm) $ID = GUIGetMsg() Switch $ID Case 0 ContinueLoop Case $GUI_EVENT_CLOSE ExitLoop Case $Button[0] ConsoleWrite('Red' & @CR) Case $Button[1] ConsoleWrite('Yellow' & @CR) Case $Button[2] ConsoleWrite('Green' & @CR) Case Else EndSwitch WEnd Func _LoadResourceImage($hInstance, $sType, $sName, $iLanguage = 0) Local $hInfo, $hData, $pData, $iSize, $hMem, $pMem, $pStream, $hBitmap If Not $hInstance Then $hInstance = _WinAPI_GetModuleHandle('') EndIf If $iLanguage Then $hInfo = _WinAPI_FindResourceEx($hInstance, $sType, $sName, $iLanguage) Else $hInfo = _WinAPI_FindResource($hInstance, $sType, $sName) EndIf $hData = _WinAPI_LoadResource($hInstance, $hInfo) $iSize = _WinAPI_SizeOfResource($hInstance, $hInfo) $pData = _WinAPI_LockResource($hData) If @Error Then Return SetError(1, 0, 0) EndIf $hMem = _MemGlobalAlloc($iSize, $GMEM_MOVEABLE) $pMem = _MemGlobalLock($hMem) _WinAPI_MoveMemory($pMem, $pData, $iSize) _MemGlobalUnlock($hMem) $pStream = _WinAPI_CreateStreamOnHGlobal($hMem) _GDIPlus_Startup() $hBitmap = _GDIPlus_BitmapCreateFromStream($pStream) _GDIPlus_Shutdown() _WinAPI_ReleaseStream($pStream) If Not $hBitmap Then Return SetError(2, 0, 0) EndIf Return $hBitmap EndFunc ;==>_LoadResourceImage #cs Func _GDIPlus_BitmapCreateFromStream($pStream) Local $Ret = DllCall($ghGDIPDll, 'uint', 'GdipCreateBitmapFromStream', 'ptr', $pStream, 'handle*', 0) If (@Error) Or ($Ret[0]) Then Return SetError(1, 0, 0) EndIf Return $Ret[2] EndFunc ;==>_GDIPlus_BitmapCreateFromStream #ce Digisoul 1 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
topten Posted July 30, 2015 Posted July 30, 2015 Thank you for this great UDFThere is a tiny select-like area around the image with button. Is it possible to remove it?http://postimg.org/image/9c49urnnj/
topten Posted July 30, 2015 Posted July 30, 2015 I will dare to answer my own question There is an UDF developed for thisJust add to includes#include "NoFocusLines.au3" #include <ButtonConstants.au3> ; And declare in Globals $fGlobal = True ; this will switch off all spots and lines for all controlsAlready tested in WIN 8
Kira16651 Posted September 16, 2015 Posted September 16, 2015 (edited) Awesome work, thanks man that is just what I needed. Edited September 16, 2015 by Kira16651
lorenkinzel Posted September 17, 2015 Posted September 17, 2015 Thank you for this great UDFThere is a tiny select-like area around the image with button. Is it possible to remove it? All you need to do is comment-out line 37 of Skin_Ex.au3.Line 36 explains it.
Damein Posted December 3, 2015 Posted December 3, 2015 Unless I'm missing something... does this no longer work with the current AutoIt? It skins everything correctly but it doesn't seem to allow the buttons to be clicked. It flashes as if you clicked it but the Switch never works. Nothing is written to the Console. Thanks! Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic
argumentum Posted December 3, 2015 Posted December 3, 2015 (edited) Edit: removed, no longer needed Edited December 6, 2015 by argumentum no longer needed Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Yashied Posted December 6, 2015 Author Posted December 6, 2015 (edited) I've updated the first post, please download archive again. Edited December 6, 2015 by Yashied argumentum 1 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
incepator Posted November 6, 2016 Posted November 6, 2016 In new version of autoit..is not working this script.
incepator Posted October 1, 2018 Posted October 1, 2018 (edited) With the new version of autoit not working, can anyone make an update? Thanks! Edited October 1, 2018 by incepator
BrewManNH Posted October 1, 2018 Posted October 1, 2018 On 11/6/2016 at 1:08 PM, incepator said: In new version of autoit..is not working this script. What's not working, and what is it doing or not doing that is wrong? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
mihelson83 Posted August 22, 2019 Posted August 22, 2019 Some ideas in attach for virtual keys, like: images in another folder, don't lose focus then click on buttons. Clickable area between buttons. Thank to Yashied for nice work. The topic is still relevant. SkinUfdWorking.zip
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now