Jump to content

Recommended Posts

Posted (edited)

This is a place to post GUI examples that other users may find interesting. Try to code clearly and concisely please for example DON'T USE MAGIC NUMBERS!

Splash Screen:

#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Global Const $SC_DRAGMOVE = 0xF012

Example() ; Idea by prizm1

Func Example()
    Local $iHeight = 250, $iWidth = 400

    Local $hGUI = GUICreate('', $iWidth, $iHeight, Default, Default, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)
    GUICtrlCreateGroup('', 0, -5, $iWidth, $iHeight + 5, $WS_THICKFRAME)
    GUICtrlCreateGroup('', -99, -99, 1, 1)
    Local $iClose = GUICtrlCreateButton('Close', $iWidth - 100, $iHeight - 40, 85, 25)

    GUISetState(@SW_SHOW, $hGUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $iClose
                ExitLoop

            Case $GUI_EVENT_PRIMARYDOWN
                _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)

        EndSwitch
    WEnd

    GUIDelete($hGUI)
EndFunc   ;==>Example
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

Please post examples only. This isn't a request thread.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted (edited)

One of my old projects...

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinApi.au3>
Global $RBOX_EVENT_CLOSE = 1
Global $ROUNDES = 20, $LastHwnd = 0
Global $GUIBKCOLOR = 0xEEC591
Global $ARRAY_COLOR_TOP_MIN[3] = [36 ,65 ,142] , $ARRAY_COLOR_TOP_MAX[3] = [11 ,42 ,122]

Local $hGui = RBoxCreate("Gui Design PHD",800,600)

While 1
CheckX($hGui,$RBOX_EVENT_CLOSE,"GuiCtrlSetColor("&$RBOX_EVENT_CLOSE&",0xA3A3A3)","GuiCtrlSetColor("&$RBOX_EVENT_CLOSE&",0x555555)")
$gMsg = GUIGetMsg()
Switch $gMsg
Case $RBOX_EVENT_CLOSE, $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func RBoxCreate($Title,$width, $height ,$left=-1 ,$top=-1 ,$show=1)
Local $GUI = GUICreate($Title,$width,$height,$left,$top,$WS_POPUP)
GUISetBkColor($GUIBKCOLOR,$GUI)
_GuiRoundCorners($GUI,0,0,$ROUNDES,$ROUNDES)
$RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X',$width-20,3,25,25)
GUICtrlSetCursor($RBOX_EVENT_CLOSE,0)
GUICtrlSetBkColor($RBOX_EVENT_CLOSE,-2)
GUICtrlSetFont($RBOX_EVENT_CLOSE,15,800)
GUICtrlSetColor($RBOX_EVENT_CLOSE,0x555555)
$Title &= " "
Local $hTitle = GUICtrlCreateLabel($Title,0,0,$width-20,26,$SS_CENTER,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetFont($hTitle,17,400,0,"Consolas")
GUICtrlSetBkColor($hTitle,-2)
Local $Graphic = GUICtrlCreateGraphic (0,0, $width, 25)
GUICtrlSetState($Graphic,$Gui_DISABLE)
GradientFill($Graphic, 0, 0, $width, 25, $ARRAY_COLOR_TOP_MIN, $ARRAY_COLOR_TOP_MAX)
If $show = 1 Then GUISetState(@SW_SHOW,$GUI)
Return $GUI
EndFunc

Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
Local $cGui = GUIGetCursorInfo($hGui)
If Not IsArray($cGui) Then Return 0
if $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd",$cGui[4])
if $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd",$cGui[4])
EndFunc


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

Func GradientFill($im, $x1, $y1, $width, $height, $left_color, $right_color)

Local $color0=($left_color[0]-$right_color[0])/$height
Local $color1=($left_color[1]-$right_color[1])/$height
$color2=($left_color[2]-$right_color[2])/$height
For $Y=0 to $height-1

$red=$left_color[0]-floor($Y*$color0)
$green=$left_color[1]-floor($Y*$color1)
$blue=$left_color[2]-floor($Y*$color2)

$col = Dec(Hex($blue,2) & Hex($green,2) & Hex($red,2))

GUICtrlSetGraphic($im,$GUI_GR_COLOR, $col)
GUICtrlSetGraphic($im,$GUI_GR_MOVE,0,$Y)
GUICtrlSetGraphic($im,$GUI_GR_LINE,$width,$Y)
Next
GUICtrlSetGraphic($im,$GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic($im,$GUI_GR_MOVE,0,$height)
GUICtrlSetGraphic($im,$GUI_GR_LINE,$width,$height)
GUICtrlSetGraphic($im,$GUI_GR_REFRESH)
EndFunc

Here is a screen : http://prntscr.com/ni5sq

Edited by PlayHD
Posted (edited)

PlayHD,

Just looking at your code what is -3? A label?

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

@guinness -3 is $GUI_EVENT_CLOSE

Example:

#include <GUIConstantsEx.au3>
MsgBox(0,0,$GUI_EVENT_CLOSE)

Please refrain from using magic numbers when posting examples in the Forum, as I said above the code should be clear and concise.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

I use this template in my projects:

I like it. Thanks for sharing

.... GOTOs? We don't need no stinkin' GOTOs! ....
Posted (edited)

One of my own favourite designs is Resources to run the program are in the zip file attached to the first post in the linked to thread. The idea was to hide all the controls and avoid making its operation obvious. This is generally a bad idea, but this is not true in this particular case. While there have been no comments, I think it's a cool design, especially the background image. It also has one or two 'unique' features. :)

Posted Image

Controls only appear when you mouse over them.

Not exactly obvious now is it? :blink:

Edited by czardas
Posted (edited)

This is an "exit splash". I stripped all the stuff from the GUI because they're boring work items.

The point is: on exit.

Livening-up work items needs to be subtle.

#include <GUIConstantSex.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <MenuConstants.au3>
$gui = GUICreate("gui", 80, @DesktopHeight * .925, @DesktopWidth * .75, 10, -1, $WS_EX_COMPOSITED)
WinSetOnTop("gui", "", 1)
$movePatch = GUICtrlCreateLabel("", 1, @DesktopHeight * .925 * .5, 78, 40)
GUICtrlSetBkColor($movePatch, 0x302030)
GUICtrlSetTip($movePatch, "hold here to move")
GUISetState()
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
BlueAway()
GetSkinny()
ExitLoop
Case $nMsg = $movePatch
move_it()
EndSelect
WEnd
Func move_it()
_SendMessage($gui, $WM_SYSCOMMAND, ($SC_MOVE + $HTCAPTION), 0)
EndFunc ;==>move_it
Func BlueAway()
GUISetBkColor(0x0000ff, $gui)
For $i = 250 To 120 Step -1.5
WinSetTrans($gui, "", $i)
Next
EndFunc ;==>BlueAway
Func GetSkinny()
For $i = 80 To 4 Step -1
WinMove($gui, "", @DesktopWidth * .75, 10, $i, @DesktopHeight * .925)
Next
GetShort()
EndFunc ;==>GetSkinny
Func GetShort()
For $i = @DesktopHeight * .925 To 4 Step -1
WinMove($gui, "", @DesktopWidth * .75, 10, 4, $i)
Next
EndFunc ;==>GetShort
Edited by lorenkinzel
Posted (edited)

Thank you for these examples. How about an example of a floating, non-focusing toolbar please.

Posted Image

I still can't believe how I got so lucky with this arrangement, which caters for all printable win-1252 codepage extended ascii characters. Only 70 keys being required: filling exactly 5 rows of 14 keys. Talk about serendipity, or what! :D

Please refrain from using magic numbers when posting examples in the Forum

There is only one exception to this: That is when the required constant is missing from the includes library. Edited by czardas
Posted

There is only one exception to this: That is when the required constant is missing from the includes library.

True, but that put it in a comment of what it should be e.g.

0xFF0 ; WM_SOMETHING or MSG_OKCANCEL

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

Here are 2 examples of using transparency in a GUI. The first uses a background image that is used to display an oval shaped GUI and controls on top of it. It's just a basic one color oval, but you can use anything in it's place to make a GUI of any shape, as long as the background has a consistent single color to be used for the transparent color.

The second is a GUI that is nearly fully transparent except for the label text. This example also shows how to use a label as a hyperlink, and a label that can be used to drag a GUI around like a title bar.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
Opt("GUIOnEventMode", 1)
Global $URL[4]
Global $Active = 1
_Main()
_Links()
Func _Main() ; Partially transparent GUI
    $Temp = GUICreate("", 800, 280, -1, -1, $WS_POPUP, $WS_EX_LAYERED) ; set up GUI to be transparent
    GUISetBkColor(0x9FBAD8) ; set the back ground color of the GUI to match the color of the upper left pixel of the back ground picture
    GUICtrlCreatePic(@ScriptDir & "\bg.bmp", 0, 0, 0, 0) ; use a bmp as the back ground picture, jpg can be used but it won't look as good.
    GUICtrlSetState(-1, $GUI_DISABLE) ; disable the picture so you can interact with the controls
    GUISetOnEvent($GUI_EVENT_CLOSE, "_TempClose1")
    GUICtrlSetFont(-1, 10, 800, -1, "Consolas")
    GUICtrlSetColor(-1, 0x0000000)
    GUICtrlCreateButton(" Close ", 225, 210, -1) ; buttons can show artifacts that you don't want on your GUI
    GUICtrlSetOnEvent(-1, "_TempClose1")
    GUICtrlCreateIcon("shell32.dll", -28, 230, 150) ; icons look much better on this type of GUI
    GUICtrlSetOnEvent(-1, "_TempClose1") ; the icon acts like a button
    Local $idProgress = GUICtrlCreateProgress(110, 100, 280, 20)
    $iProgress = 1
    GUISetState()
    While $Active
        Sleep(100)
        $iProgress += 1
        If $iProgress = 101 Then $iProgress = 1
        GUICtrlSetData($idProgress, $iProgress)
    WEnd
EndFunc ;==>_Main

Func _Links() ; Fully transparent GUI with hyperlinks
    Local $Func[4]
    $URL[0] = "http://www.autoitscript.com/forum"
    $URL[1] = "http://www.autoitscript.com/forum/forum/2-general-help-and-support/"
    $URL[2] = "http://www.autoitscript.com/forum/forum/9-example-scripts/"
    $URL[3] = "Extended Message Box"
    Local $Text = "You can drag the GUI around by left clicking on this label and dragging it." & @LF & @LF & _
            "Some helpful links: "
    $Func[0] = "Main forum page"
    $Func[1] = "General Help and Support"
    $Func[2] = "Example Scripts"
    $Func[3] = ""
    $Temp = GUICreate("", 800, 280, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0xFFFFFF) ; set the back ground color of the GUI to match the color of the Upper left pixel of the background image. In this case it's white.
    GUICtrlCreatePic(@ScriptDir & "\White.bmp", 0, 0, 0, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_TempClose")
    GUISetBkColor(0xFFFFFF, $Temp)
    GUICtrlCreateLabel($Text, 40, 10, 750, 100, Default, $GUI_WS_EX_PARENTDRAG) ; You can drag the window around with this label
    GUICtrlSetFont(-1, 10, 800, -1, "Consolas")
    GUICtrlSetBkColor(-1, 0x00DDDD) ; sets the back ground color of the label so you can see where it starts/ends
    GUICtrlSetColor(-1, 0x0000000)
    GUICtrlCreateButton(" Close ", 360, 230, -1)
    GUICtrlSetOnEvent(-1, "_TempClose")
    For $I = 0 To 3
        GUICtrlCreateLabel($Func[$I], 40, 130 + ($I * 20), 200, 20)
        GUICtrlSetColor(-1, 0x000000)
        GUICtrlSetFont(-1, 9, 400, 0)
    Next
    GUICtrlCreateLabel($URL[0], 260, 130, 400, 20)
    GUICtrlSetOnEvent(-1, "_ForumURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    GUICtrlCreateLabel($URL[1], 260, 150, 400, 20)
    GUICtrlSetOnEvent(-1, "_GHSURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    GUICtrlCreateLabel($URL[2], 260, 170, 348, 20)
    GUICtrlSetOnEvent(-1, "_ExampleURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    GUICtrlCreateLabel($URL[3], 260, 190, 400, 20)
    GUICtrlSetOnEvent(-1, "_EMBURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    GUISetState()
    While 1
        Sleep(10)
    WEnd
EndFunc ;==>_Links
Func _TempClose()
    Exit
EndFunc ;==>_TempClose
Func _TempClose1()
    $Active = 0
    GUIDelete()
EndFunc ;==>_TempClose1
Func _ForumURL()
    ShellExecute($URL[0])
EndFunc ;==>_ForumURL
Func _GHSURL()
    ShellExecute($URL[1])
EndFunc ;==>_GHSURL
Func _ExampleURL()
    ShellExecute($URL[2])
EndFunc ;==>_ExampleURL
Func _EMBURL()
    ShellExecute("http://www.autoitscript.com/forum/index.php?showtopic=109096")
EndFunc ;==>_EMBURL

You will need the files in the attached zip to see these in action, extract them to the same folder that the script is being run from.

You can use files other than BMP files, but they won't look as good because of artifacting due to image compression. A PNG should/might work as well, I haven't tried that yet.

Backgrounds.zip

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 Gude
How 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

  • 2 weeks later...
  • 2 weeks later...
Posted (edited)

maybe

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
#include <EditConstants.au3>

dim $Label1[100]
$Form1 = GUICreate("forum ", 0, 0, -1, -1)
GUISetBkColor(0x0000FF)
GUISetState(@SW_SHOW)
grow($Form1, 380, 380, 1, 5)
local $iWinSize = WinGetClientSize($Form1 )

$Label1[1] = GUICtrlCreateLabel("autoit ı love you", 56+$iWinSize[0], 24+$iWinSize[1], 217, 17)
GUICtrlSetTip(-1," by"& @CRLF&".@mesale0077.")
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)

$Label1[2]= GUICtrlCreateLabel("autoit :", 16+$iWinSize[0] ,56+$iWinSize[1], 66, 17)
GUICtrlSetTip(-1," by"& @CRLF&".@mesale0077.")
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)

$Label1[3] = GUICtrlCreateLabel("autoit love :", 16+$iWinSize[0], 128+$iWinSize[1], 63, 17)
GUICtrlSetTip(-1," by"& @CRLF&".@mesale0077.")
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label1[4] = GUICtrlCreateInput("", 16+$iWinSize[0], 88+$iWinSize[1], 289, 21)


$Label1[5] = GUICtrlCreateInput("", 16+$iWinSize[0], 160+$iWinSize[1], 289, 21)

$Label1[6] = GUICtrlCreateButton("ok", 24+$iWinSize[0], 224+$iWinSize[1], 97, 33, $WS_GROUP)

GUICtrlSetCursor (-1, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Label1[7]= GUICtrlCreateButton("exit", 200+$iWinSize[0], 224+$iWinSize[1], 97, 33, $WS_GROUP)

GUICtrlSetCursor (-1, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

for $66= 1 to 7
AnimateControl($Form1,$Label1[$66],4,1,5,1)

next





While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
for $66= 1 to 7
AnimateControl($Form1,$Label1[$66],8,1,5,2)

next
grow($Form1, 0, 0, 3, 2)
Exit
Case $Label1[6]
EndSwitch
WEnd

Func AnimateControl($hWnd, $iHandle, $iAnimate = 1, $iSpeed = 1,$hoz=1,$pp=1)

if $pp=1 then
local $iPos = ControlGetPos($hWnd, "", $iHandle)
local $iWinSizee = WinGetClientSize($hWnd)
$iPos[0]=$iPos[0]-$iWinSize[0]
$iPos[1]=$iPos[1]-$iWinSize[1]


else
if $pp=2 then
local $iPos = ControlGetPos($hWnd, "", $iHandle)
local $iWinSizee = WinGetClientSize($hWnd)

endif
endif

If $iAnimate = 1 Then
For $i = -40 To $iPos[0] step $hoz
GUICtrlSetPos($iHandle, $i, $iPos[1])
GUICtrlSetState(-1,@SW_show)
Sleep($iSpeed)
Next
Return
EndIf

If $iAnimate = 2 Then
For $i = $iWinSizee[0] To $iPos[0] Step -1*$hoz

GUICtrlSetPos($iHandle, $i, $iPos[1])
GUICtrlSetState(-1,@SW_show)
Sleep($iSpeed)
Next
Return
EndIf

If $iAnimate = 3 Then
For $i = 0 To $iPos[1] step $hoz
GUICtrlSetPos($iHandle, $iPos[0], $i)
GUICtrlSetState(-1,@SW_show)
Sleep($iSpeed)
Next
Return
EndIf

If $iAnimate = 4 Then
For $i = $iWinSizee[1] + 30 To $iPos[1] Step -1*$hoz
GUICtrlSetPos($iHandle, $iPos[0], $i)
GUICtrlSetState(-1,@SW_show)
Sleep($iSpeed)
Next
Return
EndIf

If $iAnimate = 5 Then
For $i = $iPos[0] To -$iWinSizee[0] step -1*$hoz
GUICtrlSetPos($iHandle, $i, $iPos[1])

Sleep($iSpeed)
Next
GUICtrlDelete( $iHandle)
Return
EndIf
If $iAnimate = 6 Then
For $i = $iPos[0] To $iWinSizee[0]Step 1*$hoz

GUICtrlSetPos($iHandle, $i, $iPos[1])

Sleep($iSpeed)
Next
GUICtrlDelete( $iHandle)
Return
EndIf
If $iAnimate = 7 Then
For $i = $iPos[1] To -40 step -1*$hoz
GUICtrlSetPos($iHandle, $iPos[0], $i)

Sleep($iSpeed)
Next
GUICtrlDelete($iHandle)
Return
EndIf

If $iAnimate = 8 Then
For $i = $iPos[1] To $iWinSizee[1] + $iPos[1] Step 1*$hoz
GUICtrlSetPos($iHandle, $iPos[0], $i)

Sleep($iSpeed)
Next
GUICtrlDelete($iHandle)
Return
EndIf

EndFunc

Func grow($gui, $guix, $guiy, $type, $step)
$size = WinGetClientSize($gui)
If $type = 1 Then
For $x = $size[0] To $guix Step $step/3
$size = WinGetClientSize($gui)
$zx = (@DesktopWidth/2) - ($size[0]/2)
$zy = (@DesktopHeight/2) - ($size[1]/2)
WinMove($gui, '', $zx, $zy, $x + $step, 25)
Next
For $y = $size[1] To $guiy Step $step/2
$size = WinGetClientSize($gui)
$zx = (@DesktopWidth/2) - ($size[0]/2)
$zy = (@DesktopHeight/2) - ($size[1]/2)
WinMove($gui, '', $zx, $zy, $x, $y + $step)
Next
endif
If $type = 2 Then
For $w = 0 To 102 Step $step/4
$size = WinGetClientSize($gui)
$dw = (@DesktopWidth/2) - ($size[0]/2)
$dh = (@DesktopHeight/2) - ($size[1]/2)
WinMove($gui, '', $dw, $dh, ($guix/100)*$w, ($guiy/100)*$w)
Next
EndIf
If $type = 3 Then

local $aPos = WinGetClientSize($gui)
local $gPos = WinGetPos($gui)

for $aaa= 1 to $aPos[0]-28 step 2
WinMove($gui, "", $gPos[0], $gPos[1], $aPos[0], $aPos[1] - $aaa)
next
$Pos = WinGetPos($gui)
for $mm= 1 to $aPos[1]+200 step 2
WinMove($gui, "", $gPos[0], $gPos[1], $aPos[0] - $mm, 28)
next

endif

EndFunc
Edited by mesale0077
Posted (edited)

Please use [autoit][/autoit] tags rather than the generic (code)(/code) tags. Thanks

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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