Requesting help with using Gdip to display several images that each change on mouse over Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Requesting help with using Gdip to display several images that each change on mouse over

12 Jul 2023, 07:27

Hi!

I use Gdip to create guis because it allows me to use any floating image on screen with full transparency and no 'window'.
For the things I've used this for so far, it's been perfect - but I'm struggling with having several images that can be clicked.

What I'm trying to achieve in detail, is several images displayed on screen with a hotkey. Each image should be replaced with a different image when the mouse is hovered over it, but returns to the original image when the mouse leaves it (essentially mimicking a 'highlighted' effect).
Then, each of these images will also run their own set of tasks when they are clicked

I've found lots of scripts that allow these 'mouse hover, mouse leave' effects within a standard gui, but that seems to lack the customisation of gdip. My goal with gdip is to make this an overlay on top of my existing window that will display the images only. No background or window and can be presented with transparency effects, so that it appears as though it exists within the application underneath

I've managed to get as far as displaying 2 example images at once that play a test sound on mouse hover - but I don't know how to apply a different test sound to each image individually, so I can work on per-image effects from there



Here is what I have so far, but I feel I'm probably going about this in the wrong way and that a simpler way may be possible.

Also please understand that my gdip knowledge is limited to working examples I have... There's probably lots here that isn't needed, it's just what I've been able to edit from other scripts until it does what I wanted!

Any help to point me in right direction is greatly appreciated

Code: Select all

#include gdip.ahk

Gui, 1: +HwndGuiID -Caption +E0x80000 +LastFound +OwnDialogs +Owner +hwndhwnd +alwaysontop
OnMessage(0x6, "WM_ACTIVATE")

WM_ACTIVATE(wp, lp) {
   OnMessage(0x200, wp ? "WM_MOUSEMOVE" : "")
}

WM_MOUSEMOVE(wp, lp) {
   SoundBeep 100
}

;========================================================================================

LALT::

Gui, 1: Show

sFile1=%a_scriptdir%\gui1.png
sFile2=%a_scriptdir%\gui2.png
pBitmap1:=Gdip_CreateBitmapFromFile(sFile1)
pBitmap2:=Gdip_CreateBitmapFromFile(sFile2)
Gdip_GetImageDimensions(pBitmap1,w,h)
Gdip_GetImageDimensions(pBitmap2,w,h)

hbm := CreateDIBSection(w,h)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
pGraphics:=Gdip_GraphicsFromHDC(hdc)

Gdip_DrawImage(pGraphics, pBitmap1, 0,0,w,h)
Gdip_DrawImage(pGraphics, pBitmap2, 0,0,w,h)
UpdateLayeredWindow(hwnd, hdc,(a_screenwidth-w)//2,(a_screenheight-h)//2,w,h)
Gdip_DisposeImage(pBitmap1)
Gdip_DisposeImage(pBitmap2)
Return


;LALT UP::
;Gosub CloseGUI


Escape::
ExitApp




;========Not Used Yet==========

CloseGUI:
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(pGraphics)

Gdip_Shutdown(pToken)
Reload
Thank you
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Requesting help with using Gdip to display several images that each change on mouse over

13 Jul 2023, 20:59

If you have window 8 or higher you can add a text control to your layered window ( you can't see it but you can detect it ).
With that you can use this code to do your drawing.

I normally use my own methods for this task so if you have questions about the messages they will have to be answered by someone else.
What I can say though is that if I wanted to use this code I don't think I'd have much problems editing it for my purposes and perhaps the same is true of you. ( If I get the time I will try to create an example showing how I actually would do it *Not the method shown below* ).

Code: Select all

;@mim
#SingleInstance, Force
SetBatchLines, -1
OnMessage(0x200, Func("MouseEvent")) ; WM_MOUSEMOVE

Gui, Margin, 10, 10
Gui, Add, Progress, w100 h50 vProgress1 +Backgroundd1493f
Gui, Add, Progress, w100 h50 vProgress2 +Background4667e8
Gui, Show, w400 h300
Return

GuiClose:
ExitApp

MouseEvent(wParam, lParam, Msg, Hwnd) {
;-------------------------- Progress1 --------------------------;
  if (A_GuiControl = "Progress1") {
    if (Msg = 0x0200) { ; WM_MOUSEMOVE
      TrackMouseEvent(Hwnd, 3) ; TME_HOVER + TME_LEAVE
      OnMessage(0x02A1, "MouseEvent") ; WM_MOUSEHOVER
      OnMessage(0x02A3, "MouseEvent") ; WM_MOUSELEAVE
      Return 0
    }
    else if (Msg = 0x02A1) { ; WM_MOUSEHOVER
      OnMessage(0x02A1, "")
      GuiControl, +Background9c352d, Progress1
      Return 0
    }
    else if (Msg = 0x02A3) { ; WM_MOUSELEAVE
      OnMessage(0x02A3, "")
      GuiControl, +Backgroundd1493f, Progress1
      Return 0
    }
  }
;---------------------------------------------------------------;

;-------------------------- Progress2 --------------------------;
  else if (A_GuiControl = "Progress2") {
    if (Msg = 0x0200) { ; WM_MOUSEMOVE
      TrackMouseEvent(Hwnd, 3) ; TME_HOVER + TME_LEAVE
      OnMessage(0x02A1, "MouseEvent") ; WM_MOUSEHOVER
      OnMessage(0x02A3, "MouseEvent") ; WM_MOUSELEAVE
      Return 0
    }
    else if (Msg = 0x02A1) { ; WM_MOUSEHOVER
      OnMessage(0x02A1, "")
      GuiControl, +Background3047a1, Progress2
      Return 0
    }
    else if (Msg = 0x02A3) { ; WM_MOUSELEAVE
      OnMessage(0x02A3, "")
      GuiControl, +Background4667e8, Progress2
      Return 0
    }
  }
;---------------------------------------------------------------;
}

TrackMouseEvent(HWND, Event, HoverTime := 1) {
  ; HOVER_DEFAULT = 0xFFFFFFFF
  TME_Size := 8 + (A_PtrSize * 2)
  VarSetCapacity(TME, TME_Size, 0)
   Addr := &TME
   Addr := NumPut(TME_Size, Addr + 0, "UInt")
   Addr := NumPut(Event, Addr + 0, "UInt")
   Addr := NumPut(HWND, Addr + 0, "UPtr")
   NumPut(HoverTime, Addr + 0, "UInt")
   Return DllCall("TrackMouseEvent", "Ptr", &TME, "UInt")
}
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Requesting help with using Gdip to display several images that each change on mouse over

14 Jul 2023, 02:44

Here is a simple example of how I would go about creating a layered window with buttons that change.

The code I posted earlier could be used to sub the current hover code.

.
Hover Button 1.gif
Hover Button 1.gif (337.33 KiB) Viewed 1325 times
.

I use my own class to wrap everything up into an object, if you look in the class code [ createWindow , ShowWindow , CreateGraphics , etc. ]
you should be able to recognize the same code that you are currently using to create your layered window. You can either use the class or replace it with how you are currently doing it.

I also created a custom background so that the example works without needing any external resources* ( does requires a copy of the gdip.ahk lib but you are already using it anyway )

You can see how the window is drawn in the DrawWindow function

I'm using Base 64 to create my button bitmaps, you would continue to use your current method of getting them (from a file , etc. )

if you have any questions, feel free to ask.

Code: Select all

;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;<<<<<<<<<<<<<<<<<<---------------------------     gdip.ahk
;~ #Include <PopUpWindow_V2> ; At the bottom of the script 
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Screen
Gdip_Startup()

Scale := 1
Gui1 := New PopUpWindow( { AutoShow: 1 , X: "Center" , Y: "Center" , W: 500 * Scale , H: 300 * Scale , Options: " +AlwaysOnTop -DPIScale " } ) 
Gui1.Scale := Scale


Gui1.Controls := {}
;##############
Gui1.Controls.MoveWindowButton := { X: 20 , Y: 18 , W: 310 , H: 24 , Label: "MoveWindow" }

;##############
Default := "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAjmSURBVHhe7VtbbBTXGZ71ZddrGxs7BBxijI0ve5/Lzszujg04AUIol4YE0qBYEQYScEyF0rQiRpEiRyRREoSUGyQhIRESElLISx+i8BSpT1GVhz70AakPVEhFiUqR47pcGh7+ft96kGN5KGt71/au8kuf1p45c875/vP///nPmTPKL/KLzI1o6XSrme55SLedIcN2hoEzRsr5yyTYmfPuvWGWNU0n7D5enKLZ3TpIHTOszCVgTDXTIzE1eTuqJiWcMKQrqk5COK4L7xEsq1mZUd3OXDEs52Qy1ZNxq13YwpHm6OpW96hmpX+MgGhnJCGruqIzQmc4LqxDNVMjqPcGrYSKdZtbOGLbdpNuOac40hzdjlDMk9Bs0I46aSVULNr5isp2m58/0bTexbqVeRP4VySh3/bqeCEQgiLgHiNUOpXvdmduxbDSv4ZJ/jOqGjc5Ol4dLSTYJpVO5etJZ9Dt1twIGj2iJ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xyuHkBK7GHeGlgsQoMeRdQR6e5KtyKlNhQZnprOIsQIWaG+CNTV7Kjzm2HxFis4gctIj50iTP04e6EqeCwTg8/KioezzEziiy2WK/aZIIzOuz8PDpd2M0FuJRg9fgwcBBdlYG+K6fk1kOW0W6MRGDNqX2dqim/Qt8YlngUuxO7AAAAABJRU5ErkJggg=="

cc := Gui1.Controls.IconButton1 := { X: 373 , Y: 60 , W: 64 , H: 64 , Label: "IconButton1Label" }
cc.DefaultBitmap := B64ToPBitmap( Default )
cc.HoverBitmap := B64ToPBitmap( Hover )
cc.PressedBitmap := B64ToPBitmap( Pressed )

;##############
Default := "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAjmSURBVHhe7VtbbBTXGZ71ZddrGxs7BBxijI0ve5/Lzszujg04AUIol4YE0qBYEQYScEyF0rQiRpEiRyRREoSUGyQhIRESElLISx+i8BSpT1GVhz70AakPVEhFiUqR47pcGh7+ft96kGN5KGt71/au8kuf1p45c875/vP///nPmTPKL/KLzI1o6XSrme55SLedIcN2hoEzRsr5yyTYmfPuvWGWNU0n7D5enKLZ3TpIHTOszCVgTDXTIzE1eTuqJiWcMKQrqk5COK4L7xEsq1mZUd3OXDEs52Qy1ZNxq13YwpHm6OpW96hmpX+MgGhnJCGruqIzQmc4LqxDNVMjqPcGrYSKdZtbOGLbdpNuOac40hzdjlDMk9Bs0I46aSVULNr5isp2m58/0bTexbqVeRP4VySh3/bqeCEQgiLgHiNUOpXvdmduxbDSv4ZJ/jOqGjc5Ol4dLSTYJpVO5etJZ9Dt1twIGj2iJlPXCmHq0wUVkTDMa7qZOe12r3DS29tbhYbOxVRz1Ksz84lIQruBmeNPdEu3u/kV19+/QyC64dWBhYBQVP0JseFi3gNklryducz52qvhhQROuxiov+dNCVmzx8gXA/k7YP4AV72UF3egzy9ks78bumLqf5E8/dmlMTNht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qim/Qt8YlngUuxO7AAAAABJRU5ErkJggg=="

cc := Gui1.Controls.IconButton2 := { X: 373 , Y: 153 , W: 64 , H: 64 , Label: "IconButton2Label" }
cc.DefaultBitmap := B64ToPBitmap( Default )
cc.HoverBitmap := B64ToPBitmap( Hover )
cc.PressedBitmap := B64ToPBitmap( Pressed )


Gui1.HoveredControl := ""
Gui1.PressedControl := ""


OnMessage( 0x200 , Func( "MouseHover" ).Bind( Gui1 ) )
OnMessage( 0x201 , Func( "MouseClickEvent" ).Bind( Gui1 ) )

DrawWindow( Gui1 )

return
GuiClose:
GuiContextMenu:
*ESC::ExitApp

RALT::PopUpWindow.Helper()

MoveWindow:
	PostMessage, 0xA1 , 2 
	While( GetKeyState( "LButton" , "P" ) )
		Sleep, 30
	WinGetPos, x , y ,,, % "ahk_id " Gui1.Hwnd 
	Gui1.X := x
	Gui1.Y := y
	return

IconButton1Label:
	SoundBeep, 555
	return

IconButton2Label:
	SoundBeep, 999
	return

MouseClickEvent( Gui1 ){
	CoordMode, Mouse, Client
	MouseGetPos, x , y , win
	if( win != Gui1.Hwnd || Gui1.Busy )
		return 
	x /= Gui1.Scale
	y /= Gui1.Scale
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
			if( cc.HasKey( "PressedBitmap" ) ){
				Gui1.PressedControl := k 
				SetTimer, WatchLeaveHover , Off
				DrawWindow( Gui1 )
				While( GetKeyState( "LButton" , "P" ) )
					Sleep, 30
				Gui1.PressedControl := ""
				DrawWindow( Gui1 )
				SetTimer, WatchLeaveHover , On
				MouseGetPos, x , y , win
				x /= Gui1.Scale
				y /= Gui1.Scale
				if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
					SetTimer, % cc.Label , -30
				}
				return
			}else{
				gosub, % cc.Label
			}
		}
	}
}

MouseHover( Gui1 ){
	MouseGetPos, x , y , win 
	if( win != Gui1.Hwnd || Gui1.PressedControl )
		return
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	if( !Gui1.HoveredControl ){
		for k , v in Gui1.Controls	{
			if( Gui1.LastHovered != k ){
				cc := Gui1.Controls[ k ]
				if( cc.HasKey( "DefaultBitmap" ) ){
					if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
						Gui1.LastHovered := Gui1.HoveredControl := k
						DrawWindow( Gui1 )
						SetTimer, WatchLeaveHover , 60 
						Sleep, 30
						return 0 
					}
				}
			}
		}
	}
	
}

WatchLeaveHover:
	if( Gui1.PressedControl )
		return
	MouseGetPos, x , y , win 
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	cc := Gui1.Controls[ Gui1.HoveredControl ]
	if( win != Gui1.Hwnd || !( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ) ){
		SetTimer, WatchLeaveHover , Off 
		Gui1.LastHovered := Gui1.HoveredControl := ""
		DrawWindow( Gui1 )
		sleep , 30
	}
	return

DrawWindow( Gui1 ){
	if( Gui1.Busy )
		return
	Gui1.Busy := 1
	Gui1.ClearWindow()
	Gui1.DrawBitmap( WindowBackgroundGraphics( Gui1 , Gui1.Scale ) , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 1 , AutoUpdate := 0 )
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( !cc.HasKey( "DefaultBitmap" ) )
			continue
		if( Gui1.PressedControl = k ){
			Gui1.DrawBitmap( cc.PressedBitmap , cc , dispose := 0 , AutoUpdate := 0 )
		}else if( Gui1.HoveredControl = k ){
			Gui1.DrawBitmap( cc.HoverBitmap , { X: ( cc.X - 5 ) * Gui1.Scale , Y: ( cc.Y - 5 ) * Gui1.Scale , W: ( cc.W + 10 ) * Gui1.Scale , H: ( cc.H + 10 ) * Gui1.Scale } , dispose := 0 , AutoUpdate := 0 )
		}else{
			Gui1.DrawBitmap( cc.DefaultBitmap , cc , dispose := 0 , AutoUpdate := 0 )
		}
	}
	Gui1.UpdateWindow()
	Gui1.Busy := 0
}

WindowBackgroundGraphics( Gui1 , ScaleFactor := 1 ){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 500 * ScaleFactor , 300 * ScaleFactor ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_BrushCreateSolid( "0x22000000" ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 475 * ScaleFactor , 275 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 10 * ScaleFactor , 14 * ScaleFactor , 468 * ScaleFactor , 272 * ScaleFactor , "0x66F0F0F0" , "0x66000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 470 * ScaleFactor , 270 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 11 * ScaleFactor , 11 * ScaleFactor , 473 * ScaleFactor , 273 * ScaleFactor , "0x99F0F0F0" , "0x99000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 10 * ScaleFactor , 10 * ScaleFactor , 470 * ScaleFactor , 270 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrushFromRect( 23 * ScaleFactor , 52 * ScaleFactor , 308 * ScaleFactor , 217 * ScaleFactor , "0x9952565a" , "0x6602060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 50 * ScaleFactor , 310 * ScaleFactor , 220 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRectangle( G , Brush , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	picBitmap := Gdip_CreateBitmapFromFile( "C:\Users\CivRe\OneDrive\Desktop\AHK Tools\Color Picker Mini\Screen Shots\20210117095024.png" ) , Gdip_DrawImage( G , picBitmap , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor , 0 , 0 , 884 , 337 ) , Gdip_DisposeImage( picBitmap )
	Brush := Gdip_CreateLineBrushFromRect( 20 * ScaleFactor , 51 * ScaleFactor , 310 * ScaleFactor , 219 * ScaleFactor , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 20 * ScaleFactor , 50 * ScaleFactor , 310 * ScaleFactor , 220 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 18 * ScaleFactor , 310 * ScaleFactor , 24 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Image View / " , "s" 15 * ScaleFactor " Center vCenter  c" Brush " x" 31 * ScaleFactor " y" 7 * ScaleFactor  , "Comic Sans MS" , 110 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( G , "Image View /" , "s" 15 * ScaleFactor " Center vCenter  c" Brush " x" 30 * ScaleFactor " y" 6 * ScaleFactor  , "Comic Sans MS" , 110 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x9912161a" ) , Gdip_FillRoundedRectangle( G , Brush , 140 * ScaleFactor , 20 * ScaleFactor , 186 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( G , "File Name" , "s" 12 * ScaleFactor " Center vCenter  c" Brush " x" 140 * ScaleFactor " y" 19 * ScaleFactor  , "Comic Sans MS" , 180 * ScaleFactor , 24 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrush( 0 * ScaleFactor , 0 * ScaleFactor , 100 * ScaleFactor , 100 * ScaleFactor , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRectangle( G , Pen , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrushFromRect( 342 * ScaleFactor , 21 * ScaleFactor , 127 * ScaleFactor , 249 * ScaleFactor , "0x9952565a" , "0x9902060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 340 * ScaleFactor , 20 * ScaleFactor , 130 * ScaleFactor , 250 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 341 * ScaleFactor , 21 * ScaleFactor , 129 * ScaleFactor , 248 * ScaleFactor , "0x99F0F0F0" , "0x99000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 340 * ScaleFactor , 20 * ScaleFactor , 130 * ScaleFactor , 250 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 350 * ScaleFactor , 30 * ScaleFactor , 110 * ScaleFactor , 230 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}

B64ToPBitmap( Input ){
	local ptr , uptr , pBitmap , pStream , hData , pData , Dec , DecLen , B64
	VarSetCapacity( B64 , strlen( Input ) << !!A_IsUnicode )
	B64 := Input
	If !DllCall("Crypt32.dll\CryptStringToBinary" ( ( A_IsUnicode ) ? ( "W" ) : ( "A" ) ), Ptr := A_PtrSize ? "Ptr" : "UInt" , &B64, "UInt", 0, "UInt", 0x01, Ptr, 0, "UIntP", DecLen, Ptr, 0, Ptr, 0)
		Return False
	VarSetCapacity( Dec , DecLen , 0 )
	If !DllCall("Crypt32.dll\CryptStringToBinary" (A_IsUnicode ? "W" : "A"), Ptr, &B64, "UInt", 0, "UInt", 0x01, Ptr, &Dec, "UIntP", DecLen, Ptr, 0, Ptr, 0)
		Return False
	DllCall("Kernel32.dll\RtlMoveMemory", Ptr, pData := DllCall("Kernel32.dll\GlobalLock", Ptr, hData := DllCall( "Kernel32.dll\GlobalAlloc", "UInt", 2,  UPtr := A_PtrSize ? "UPtr" : "UInt" , DecLen, UPtr), UPtr) , Ptr, &Dec, UPtr, DecLen)
	DllCall("Kernel32.dll\GlobalUnlock", Ptr, hData)
	DllCall("Ole32.dll\CreateStreamOnHGlobal", Ptr, hData, "Int", True, Ptr "P", pStream)
	DllCall("Gdiplus.dll\GdipCreateBitmapFromStream",  Ptr, pStream, Ptr "P", pBitmap)
	return pBitmap
}

;Layered Window Class
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
class PopUpWindow	{
;PopUpWindow v2.2
;Date Written: Oct 28th, 2021
;Last Edit: Feb 7th, 2022 :Changed the trigger method.
;Written By: Hellbent aka CivReborn
;SpcThanks: teadrinker , malcev 
	static Index := 0 , Windows := [] , Handles := [] , EditHwnd , HelperHwnd
	__New( obj := "" ){
		This._SetDefaults()
		This.UpdateSettings( obj )
		This._CreateWindow()
		This._CreateWindowGraphics()
		if( This.AutoShow )
			This.ShowWindow( This.Title )
	}
	_SetDefaults(){
		This.X := 10
		This.Y := 10
		This.W := 10
		This.H := 10
		This.Smoothing := 2
		This.Options := " -DPIScale +AlwaysOnTop "
		This.AutoShow := 0
		This.GdipStartUp := 0
		This.Title := ""
		
		This.Controls := []
		This.Handles := []
		This.Index := 0 
	}
	AddTrigger( obj ){
		local k , v , cc , bd
		
		This.Controls[ ++This.Index ] := { 	X:		10
										,	Y:		10
										,	W:		10
										,	H:		10	}
		for k, v in obj
			This.Controls[ This.Index ][ k ] := obj[ k ] 
		cc := This.Controls[ This.Index ]
		Gui, % This.Hwnd ":Add", Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd"
		This.Handles[ hwnd ] := This.Index
		This.Controls[ This.Index ].Hwnd := hwnd
		
		if( IsObject( cc.Label ) ){
			bd := cc.Label
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}else{
			bd := This._TriggerCall.Bind( This )
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}
		return hwnd
		
	}
	_TriggerCall(){
		MouseGetPos,,,, ctrl, 2
		Try
			;~ SetTimer, % This.Controls[ This.Handles[ ctrl ] ].Label, -0
			gosub, % This.Controls[ This.Handles[ ctrl ] ].Label
		
				
	}
	DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 0 ){
		local brush , cc 
		Brush := Gdip_BrushCreateSolid( color ) 
		Gdip_SetSmoothingMode( This.G , 3 )
		loop, % This.Controls.Length()	{
			cc := This.Controls[ A_Index ]
			Gdip_FillRectangle( This.G , Brush , cc.x , cc.y , cc.w , cc.h )
		
		}
		Gdip_DeleteBrush( Brush )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	UpdateSettings( obj := "" , UpdateGraphics := 0 ){
		local k , v
		if( IsObject( obj ) )
			for k, v in obj
				This[ k ] := obj[ k ]
		( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 ) 	
		( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 ) 	
		if( UpdateGraphics ){
			This._DestroyWindowsGraphics()
			This._CreateWindowGraphics()
		}
	}
	_CreateWindow(){
		local hwnd
		Gui , New, % " +LastFound +E0x80000 hwndhwnd -Caption  " This.Options
		PopUpWindow.Index++
		This.Index := PopUpWindow.Index
		PopUpWindow.Windows[ PopUpWindow.Index ] := This
		This.Hwnd := hwnd
		PopUpWindow.Handles[ hwnd ] := PopUpWindow.Index
		if( This.GdipStartUp && !PopUpWindow.pToken )
			PopUpWindow.pToken := GDIP_STARTUP()
	}
	_DestroyWindowsGraphics(){
		Gdip_DeleteGraphics( This.G )
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
	}
	_CreateWindowGraphics(){
		This.hbm := CreateDIBSection( This.W , This.H )
		This.hdc := CreateCompatibleDC()
		This.obm := SelectObject( This.hdc , This.hbm )
		This.G := Gdip_GraphicsFromHDC( This.hdc )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
	}
	ShowWindow( Title := "" ){
		Gui , % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
	}
	HideWindow(){
		Gui , % This.Hwnd ":Hide",
	}
	UpdateWindow( alpha := 255 ){
		UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H , alpha )
	}
	ClearWindow( AutoUpdate := 0 , Color := "" ){
		if( color != "" )
			Gdip_GraphicsClear( This.G , color )
		else
			Gdip_GraphicsClear( This.G )
		if( Autoupdate )
			This.UpdateWindow()
	}
	DrawBitmap( pBitmap , obj , dispose := 1 , AutoUpdate := 0 ){
		Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
		if( dispose )
			Gdip_DisposeImage( pBitmap )
		if( Autoupdate )
			This.UpdateWindow()
	}
	PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
		if( isObject( color ) ){
			Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) ) 
			if( color.Haskey( "Round" ) )
				Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Round )
			else
				Gdip_FillRectangle( This.G , Brush , color.X , color.Y , color.W , color.H ) 
		}else{
			Brush := Gdip_BrushCreateSolid( color ) 
			Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 ) 
		}
		Gdip_DeleteBrush( Brush )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DeleteWindow( GDIPShutdown := 0 ){
		Gui, % This.Hwnd ":Destroy"
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
		Gdip_DeleteGraphics( This.G )
		hwnd := This.Hwnd
		for k, v in PopUpWindow.Windows[ Hwnd ]
			This[k] := ""
		PopUpWindow.Windows[ Hwnd ] := ""
		if( GDIPShutdown ){
			Gdip_Shutdown( PopUpWindow.pToken )
			PopUpWindow.pToken := ""
		}
	}
	_OnClose( wParam ){
		if( wParam = 0xF060 ){	;SC_CLOSE ;[ clicking on the gui close button ]
			Try{
				Gui, % PopUpWindow.HelperHwnd ":Destroy"
				SoundBeep, 555
			}
		}
	}
	CreateCachedBitmap( pBitmap , Dispose := 0 ){
		local pCachedBitmap
		if( This.CachedBitmap )
			This.DisposeCachedbitmap()
		DllCall( "gdiplus\GdipCreateCachedBitmap" , "Ptr" , pBitmap , "Ptr" , this.G , "PtrP" , pCachedBitmap )
		This.CachedBitmap := pCachedBitmap
		if( Dispose )
			Gdip_DisposeImage( pBitmap )
	}
	DrawCachedBitmap( AutoUpdate := 0 ){
		DllCall( "gdiplus\GdipDrawCachedBitmap" , "Ptr" , this.G , "Ptr" , This.CachedBitmap , "Int" , 0 , "Int" , 0 )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DisposeCachedbitmap(){
		DllCall( "gdiplus\GdipDeleteCachedBitmap" , "Ptr" , This.CachedBitmap )
	}
	Helper(){
		local hwnd , MethodList := ["__New","UpdateSettings","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow" , "AddTrigger" , "DrawTriggers", "CreateCachedBitmap" , "DrawCachedBitmap" , "DisposeCachedbitmap" ]
		Gui, New, +AlwaysOnTop +ToolWindow +HwndHwnd
		PopUpWindow.HelperHwnd := hwnd
		Gui, Add, Edit, xm ym w250 r1 Center hwndhwnd, Gui1
		PopUpWindow.EditHwnd := hwnd
		loop, % MethodList.Length()	
			Gui, Add, Button, xm y+1 w250 r1 gPopUpWindow._HelperClip, % MethodList[ A_Index ]
		Gui, Show,,
		OnMessage( 0x112 , This._OnClose.Bind( hwnd ) )
	}
	_HelperClip(){
		local ClipList 
		
		GuiControlGet, out, % PopUpWindow.HelperHwnd ":", % PopUpWindow.EditHwnd	
		
		ClipList := 		{ 	__New: 					" := New PopUpWindow( { AutoShow: 1 , X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight , Options: "" -DPIScale +AlwaysOnTop "" } )"
							,	UpdateSettings:			".UpdateSettings( { X: """" , Y: """" , W: """" , H: """" } , UpdateGraphics := 0 )"
							,	ShowWindow:				".ShowWindow( Title := """" )"
							,	HideWindow:				".HideWindow()"
							,	UpdateWindow:			".UpdateWindow()"
							,	ClearWindow:			".ClearWindow( AutoUpdate := 0 )"
							,	DrawBitmap:				".DrawBitmap( pBitmap := """" , { X: 0 , Y: 0 , W: " Out ".W , H: " Out ".H } , dispose := 1 , AutoUpdate := 0 )"
							,	PaintBackground:		".PaintBackground( color := ""0xFF000000"" , AutoUpdate := 0 )  "  ";{ Color: ""0xFF000000"" , X: 2 , Y: 2 , W: " Out ".W - 4 , H: " Out ".H - 4 , Round: 10 }"
							,	DeleteWindow:			".DeleteWindow( GDIPShutdown := 0 )"
							,	AddTrigger:				".AddTrigger( { X: """" , Y: """" , W: """" , H: """" , Value: """" , Label: """" } )"	
							,	DrawTriggers:			".DrawTriggers( color := ""0xFFFF0000"" , AutoUpdate := 0 )"	
							,	CreateCachedBitmap:		".CreateCachedBitmap( pBitmap , Dispose := 0 )"	
							,	DrawCachedBitmap: 		".DrawCachedBitmap( AutoUpdate := 0 )"	
							,	DisposeCachedbitmap:	".DisposeCachedbitmap()"	}
							
		clipboard := Out ClipList[ A_GuiControl ]
		
	}
}

This second example is some test code that I was writing a few weeks ago to create a speech to text menu. ***Requires Win 8 or higher***
In the code is an example of how to get buttons designed in this editor to work in a layered window.

.

Image
.
Button Class and Editor: viewtopic.php?f=6&t=88153


The main points to focus on are

How the controls are created.

Code: Select all


cc := Gui1.Controls.SubmitButton := { Owner: 1 , X: 15 , Y: 20 , W: 30 , H: 30 , Text: "S" , Label: "TestFunction" , Type: "Button" }
Gui1.Controls.SubmitButton.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.SubmitButton , { BackgroundColor: "0x00000000" } )
Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
cc.Hwnd := hwnd
Gui1.Handles[ hwnd ] := cc

in the above code, GuiButtonType1.CreateButtonBitmapSet( ... is a call to the graphics portion of the button class. It returns a set of pBitmaps and a set of hBitmaps. The buttons default design is set near the top of the script.

Code: Select all

Theme1 := HBCustomButton()
GuiButtonType1.SetSessionDefaults( Theme1.All , Theme1.Default , Theme1.Hover , Theme1.Pressed )
Another thing to focus on is how hover and click is handled.

Code: Select all

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;


MouseClickEvent( Gui1 ){
	MouseGetPos,,, win , ctrl , 2
	if( win != Gui1.Hwnd )
		return
	
	if( Gui1.HoveredControlHwnd ){
	
		SetTimer, WatchLeaveHover, Off
		
		Gui1.PressedControlHwnd := Gui1.HoveredControlHwnd
		
		DrawWindow( Gui1 )
		
		While( GetKeyState( "LButton" , "P" ) )
			Sleep, 30
		
		Gui1.PressedControlHwnd :=  ""
		
		MouseGetPos,,,, ctrl , 2
		
		if( ctrl = Gui1.HoveredControlHwnd ){
			
			
			SetTimer, WatchLeaveHover, 30
			DrawWindow( Gui1 )
			return 1
			
		}else if( isObject( Gui1.Handles[ ctrl ] ) ){
			
			
			Gui1.HoveredControlHwnd := ctrl 
			DrawWindow( Gui1 )
			SetTimer, WatchLeaveHover, 30
			return 1
			
		}else{
			
			Gui1.HoveredControlHwnd := "" 
			DrawWindow( Gui1 )
			
		}
		
	}else if( isObject( Gui1.Handles[ ctrl ] ) ){
		if( Gui1.Handles[ ctrl ].HasKey( "Label" ) ){
			Try{
				gosub, % Gui1.Handles[ ctrl ].Label
			}
		}
	}
	
}

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;

WatchCursor( Gui1 , l , w , msg , hwnd ){
	MouseGetPos,,,, ctrl , 2
	if( !Gui1.Busy && !Gui1.HoveredControlHwnd && isObject( Gui1.Handles[ ctrl ] ) && Gui1.Handles[ ctrl ].Type = "Button" ){
		Gui1.HoveredControlHwnd := ctrl
		DrawWindow( Gui1 )
		SetTimer, WatchLeaveHover, 30 
	}
}

WatchLeaveHover:
	MouseGetPos,,,, ctrl , 2
	if( !Gui1.Busy && ctrl != Gui1.HoveredControlHwnd || !Gui1.HoveredControlHwnd ){
		SetTimer, WatchLeaveHover, Off
		Gui1.HoveredControlHwnd := ""
		DrawWindow( Gui1 )
		sleep, 30
	}
	
	return
and lastly is how drawing is handled.

Code: Select all

DrawWindow( Gui1 ){
	if( Gui1.Busy )
		return
	Gui1.Busy := 1
	
	Gui1.UpdateSettings( , 1 )
	Gui1.ClearWindow( AutoUpdate := 0 )
	;~ Gui1.PaintBackground( { Color: "0x66000000" , X: 2 , Y: 2 , W: Gui1.W - 4 , H: Gui1.H - 4 , Round: 10 } , AutoUpdate := 0 ) 
	Gui1.DrawBitmap( HB_BITMAP_MAKER( ScaleFactor := 1 ) , { X: 0 , Y: 0 , W: 500 , H: 600 } , dispose := 1 , AutoUpdate := 0 )
	
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		
		
		if( Gui1.PressedControlHwnd = cc.Hwnd ){
			Gui1.DrawBitmap( cc.Bitmaps.Pressed.pBitmap , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}else if( Gui1.HoveredControlHwnd = cc.Hwnd ){
			Gui1.DrawBitmap( cc.Bitmaps.Hover.pBitmap , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}else{
			Gui1.DrawBitmap( cc.Bitmaps.Default.pBitmap , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}
		
	}
	
	Gui1.UpdateWindow()
	sleep, 30
	Gui1.Busy := 0
}


.
Hover Button 2.gif
Hover Button 2.gif (234.05 KiB) Viewed 1325 times
.


This is pretty much a poc so the code isn't organized the greatest or fully tested out.

Code: Select all

;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;<<<<<<<<<<<<<<<<<<---------------------------     gdip.ahk
#Include <PopUpWindow_V2> ; This was in the last example I had posted.
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
Gdip_Startup()



Theme1 := HBCustomButton()
GuiButtonType1.SetSessionDefaults( Theme1.All , Theme1.Default , Theme1.Hover , Theme1.Pressed )


Gui1 := New PopUpWindow( { AutoShow: 1 , X: 1100 , Y: 150 , W: 250 , H: 600 , Options: " +AlwaysOnTop -DPIScale " } ) 

;~ Input := { Owner: 1 , X: 10 , Y: 10 , W: 35 , H: 30 , Text: "S" , Label: "TestFunction" }

Gui1.Controls := {}
Gui1.Handles := []


AddControls( Gui1 )



Gui1.HoveredControlHwnd := ""
Gui1.PressedControlHwnd := ""

OnMessage( 0x200 , Func( "WatchCursor" ).Bind( Gui1 ) )
OnMessage( 0x201 , Func( "MouseClickEvent" ).Bind( Gui1 ) )

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;


Gui1.DisplayList := []

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;

Gui1.WordList := []
Gui1.Commands := []

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;

SetCategories( Gui1 )



;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;


DrawWindow( Gui1 )




Gui1.FontObj := { PanelClickBypassHack: 1 
				, SelectedPanel: 1 
				, MarginX: 5 
				, MaxPanels: 10 
				, PaddingX: 15 
				, PaddingY: 7 
				, FontSize: 10 
				, AccentColor: "777777" 
				;~ ;, AccentColor: "3399ff" 
				, FontOptions: "Center vCenter Bold" 
				, FontType: "Segoe UI" 
				, MaxPanels: 10 
				, MinWidth: 120 } 


bob := New HB_ListBox_1( Main.Nodes.PathNodes[ Main.CurrentIndex ].NodeObject.WordList , , , boundFunction := "MyBoundFunction" , Gui1.FontObj , buttonObject := [ "+" , "-" , "Edit" ] , , Main.Nodes.PathNodes[ Main.CurrentIndex ].NodeObject.Header )
bob.DrawWindow()


return
GuiClose:
GuiContextMenu:
*ESC::ExitApp

RALT::PopUpWindow.Helper()

MyBoundFunction( obj , hwnd ){
	local list := obj.List
	if( obj.msg = "PanelClick" ){
		obj.msg := ""
		;~ gosub Advance
		;~ bob.List := ["desiccation","protrusion","bulge","herniation","right paracentral","left paracentral","herniation with extrusion measuring","herniation with sequestration measuring","destroyed disc with bone-on-bone appearance"]
		;~ bob.DrawWindow()
	}else{
		obj.msg := ""
	}
}

MoveWindow:
	PostMessage, 0xA1 , 2 
	While( GetKeyState( "LButton" , "P" ) )
		Sleep, 30
	WinGetPos, x , y ,,, % "ahk_id " Gui1.Hwnd 
	Gui1.X := x 
	Gui1.Y := y 
	return

WatchCursor( Gui1 , l , w , msg , hwnd ){
	MouseGetPos,,,, ctrl , 2
	if( !Gui1.Busy && !Gui1.HoveredControlHwnd && isObject( Gui1.Handles[ ctrl ] ) && Gui1.Handles[ ctrl ].Type = "Button" ){
		Gui1.HoveredControlHwnd := ctrl
		DrawWindow( Gui1 )
		SetTimer, WatchLeaveHover, 30 
	}
}

WatchLeaveHover:
	MouseGetPos,,,, ctrl , 2
	if( !Gui1.Busy && ctrl != Gui1.HoveredControlHwnd || !Gui1.HoveredControlHwnd ){
		SetTimer, WatchLeaveHover, Off
		Gui1.HoveredControlHwnd := ""
		DrawWindow( Gui1 )
		sleep, 30
	}
	
	return

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;

AddControls( Gui1 ){

	;~ { X: 20 , Y: 25 , W: 20 , H: 20 }
	cc := Gui1.Controls.SubmitButton := { Owner: 1 , X: 15 , Y: 20 , W: 30 , H: 30 , Text: "S" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.SubmitButton.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.SubmitButton , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc

	
	;~ { X: 160 , Y: 25 , W: 20 , H: 20 }
	cc := Gui1.Controls.ResetButton := { Owner: 1 , X: 155 , Y: 20 , W: 30 , H: 30 , Text: "R" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.ResetButton.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.ResetButton , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc

	;~ { X: 145 , Y: 55 , W: 40 , H: 40 }
	cc := Gui1.Controls.ExtraButton1 := { Owner: 1 , X: 145 , Y: 55 , W: 40 , H: 40 , Text: "x" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.ExtraButton1.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.ExtraButton1 , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc

	;~ { X: 145 , Y: 90 , W: 40 , H: 40 }
	cc := Gui1.Controls.ExtraButton2 := { Owner: 1 , X: 145 , Y: 90 , W: 40 , H: 160 , Text: "x" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.ExtraButton2.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.ExtraButton2 , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc

	;~ { X: 145 , Y: 125 , W: 40 , H: 40 }
	cc := Gui1.Controls.Blah1 := { Owner: 1 , X: 145 , Y: 245 , W: 40 , H: 185 , Text: "x" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.Blah1.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.Blah1 , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc

	;~ { X: 20 , Y: 390 , W: 40 , H: 40 }
	cc := Gui1.Controls.Blah2 := { Owner: 1 , X: 20 , Y: 390 , W: 40 , H: 40 , Text: "x" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.Blah2.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.Blah2 , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc

	;~ { X: 60 , Y: 390 , W: 40 , H: 40 }
	cc := Gui1.Controls.Blah3 := { Owner: 1 , X: 60 , Y: 390 , W: 40 , H: 40 , Text: "x" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.Blah3.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.Blah3 , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc

	;~ { X: 100 , Y: 390 , W: 40 , H: 40 }
	cc := Gui1.Controls.Blah4 := { Owner: 1 , X: 100 , Y: 390 , W: 40 , H: 40 , Text: "x" , Label: "TestFunction" , Type: "Button" }
	Gui1.Controls.Blah4.Bitmaps := GuiButtonType1.CreateButtonBitmapSet( Gui1.Controls.Blah4 , { BackgroundColor: "0x00000000" } )
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc


	;~ { X: 50 , Y: 20 , W: 100 , H: 30 }
	cc := Gui1.Controls.MoveWindow := { X: 50 , Y: 20 , W: 100 , H: 30 , Text: "Category" , Label: "MoveWindow" }
	Gui, % Gui1.Hwnd ":Add" , Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd "
	cc.Hwnd := hwnd
	Gui1.Handles[ hwnd ] := cc
}
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;


MouseClickEvent( Gui1 ){
	MouseGetPos,,, win , ctrl , 2
	if( win != Gui1.Hwnd )
		return
	
	if( Gui1.HoveredControlHwnd ){
	
		SetTimer, WatchLeaveHover, Off
		
		Gui1.PressedControlHwnd := Gui1.HoveredControlHwnd
		
		DrawWindow( Gui1 )
		
		While( GetKeyState( "LButton" , "P" ) )
			Sleep, 30
		
		Gui1.PressedControlHwnd :=  ""
		
		MouseGetPos,,,, ctrl , 2
		
		if( ctrl = Gui1.HoveredControlHwnd ){
			
			
			SetTimer, WatchLeaveHover, 30
			DrawWindow( Gui1 )
			return 1
			
		}else if( isObject( Gui1.Handles[ ctrl ] ) ){
			
			
			Gui1.HoveredControlHwnd := ctrl 
			DrawWindow( Gui1 )
			SetTimer, WatchLeaveHover, 30
			return 1
			
		}else{
			
			Gui1.HoveredControlHwnd := "" 
			DrawWindow( Gui1 )
			
		}
		
	}else if( isObject( Gui1.Handles[ ctrl ] ) ){
		if( Gui1.Handles[ ctrl ].HasKey( "Label" ) ){
			Try{
				gosub, % Gui1.Handles[ ctrl ].Label
			}
		}
	}
	
}

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;

SetCategories( Gui1 ){
	
	cc := Gui1.Categories := {}
	cc.List := [ "Functions" , "Classes" , "Run" , "GDIP" ]
	cc.WordList := [ "Functions" , "Classes" , "Run_Program" , "G_D_I_P" ]
	cc.CoundList := []

	cc.Header := "Categories"
	loop, % cc.WordList.Length()	{
		cc.CoundList[ A_Index ] := 0
		Gui1.WordList.Push( Gui1.Categories.WordList[ A_Index ] )
	}
	cc.HasParams := 0
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



	cc := Gui1.Categories.Functions := {}
	cc.List := [ "Random" ]
	cc.WordList := [ "Random" ]
	cc.CoundList := []
	cc.Header := "Functions"
	loop, % cc.WordList.Length()	{
		cc.CoundList[ A_Index ] := 0
		Gui1.WordList.Push( cc.WordList[ A_Index ] )
	}
	cc.HasParams := 0
	;######################
	cc := Gui1.Categories.Functions.Random := {}
	cc.List := [ "Min" , "Max" ]
	cc.WordList := [ "Min" , "Max" ]
	cc.CoundList := []
	loop, % cc.WordList.Length()	{
		cc.CoundList[ A_Index ] := 0
		Gui1.WordList.Push( cc.WordList[ A_Index ] )
	}
	cc.HasParams := 1
	cc.CallPath := "Random_ClipboardString"
	;&&&&&&&&&&&&&&&&&&&&&&&&&
	cc := Gui1.Categories.Functions.Random.Min := {}
	cc.List := [ "0" , "1" , "5" , "10" , "20" , "25" , "50" , "100"  ]
	cc.WordList := [ "0" , "1" , "5" , "10" , "20" , "25" , "50" , "100" ]
	cc.CoundList := []
	cc.Header := "Min"
	loop, % cc.WordList.Length()	{
		cc.CoundList[ A_Index ] := 0
		Gui1.WordList.Push( cc.WordList[ A_Index ] )
	}
	cc.HasParams := 0
	;&&&&&&&&&&&&&&&&&&&&&&&&&
	cc := Gui1.Categories.Functions.Random.Max := {}
	cc.List := [ "0" , "1" , "5" , "10" , "20" , "25" , "50" , "100"  ]
	cc.WordList := [ "0" , "1" , "5" , "10" , "20" , "25" , "50" , "100"  ]
	cc.CoundList := []
	cc.Header := "Max"
	loop, % cc.WordList.Length()	{
		cc.CoundList[ A_Index ] := 0
		Gui1.WordList.Push( cc.WordList[ A_Index ] )
	}
	cc.HasParams := 0



	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	cc := Gui1.Categories.Run := {}
	cc.List := [ "Mini" , "ColorPicker" , "QuickCodeTester" , "QuickRunV3" , "InstaNoteTestVersion" , "DockIt" ]
	cc.WordList := [ "Mini" , "Color_Picker" , "Quick_Code_Tester" , "Quick_Run_Version_3" , "InstaNote_Current_Test_Version" , "Dock_It" ]
	cc.CoundList := []
	cc.Header := "Run It"
	loop, % cc.WordList.Length()	{
		cc.CoundList[ A_Index ] := 0
		Gui1.WordList.Push( cc.WordList[ A_Index ] )
	}
	cc.HasParams := 0
	;**************************************
	;######################
	cc := Gui1.Categories.Run.Mini := {}
	cc.CoundList := []
	cc.CoundList.Push( 0 )
	cc.Path := "C:\Users\CivRe\OneDrive\Desktop\AHK Tools\Color Picker Mini\Color Picker Mini v1.0.2.ahk"
	;######################
	cc := Gui1.Categories.Run.ColorPicker := {}
	cc.CoundList := []
	cc.CoundList.Push( 0 )
	cc.Path := "C:\Users\CivRe\OneDrive\Desktop\AHK Tools\Color Picker v3\Color Picker v3.1.ahk"
	;######################
	cc := Gui1.Categories.Run.QuickCodeTester := {}
	cc.CoundList := []
	cc.CoundList.Push( 0 )
	cc.Path := "C:\Users\CivRe\OneDrive\Desktop\AHK Tools\Quick Code Tester By GeekDude\CodeQuickTester_v2.8.ahk"
	;######################
	cc := Gui1.Categories.Run.QuickRunV3 := {}
	cc.CoundList := []
	cc.CoundList.Push( 0 )
	cc.Path := "C:\Users\CivRe\OneDrive\Desktop\Quick Run v3.1.ahk"
	;######################
	cc := Gui1.Categories.Run.InstaNoteTestVersion := {}
	cc.CoundList := []
	cc.CoundList.Push( 0 )
	cc.Path := "C:\Users\CivRe\OneDrive\Desktop\AHK Scripts\Key Words [ Create a list of string replacements ]\InstaNote With Side Panel.ahk"
	;######################
	cc := Gui1.Categories.Run.DockIt := {}
	cc.CoundList := []
	cc.CoundList.Push( 0 )
	cc.Path := "C:\Users\CivRe\OneDrive\Desktop\Current active scripts\DockIt v1.1.ahk"
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	Gui1.Categories.Classes := {}



	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	Gui1.Categories.GDIP := {}
	Gui1.Categories.GDIP.List := [ "NewPBitmap" , "NewHBitmap" , "NewPen" ]
	Gui1.Categories.GDIP.WordList := [ "New_P_Bitmap" , "New_H_Bitmap" , "New_Pen"]
	Gui1.Categories.GDIP.Header := "GDIP Functions"
	loop, % Gui1.Categories.GDIP.WordList.Length()	{
		Gui1.WordList.Push( Gui1.Categories.GDIP.WordList[ A_Index ] )
	}
	Gui1.Categories.GDIP.HasParams := 0
	;************************************************************************************************
	;************************************************************************************************
	Gui1.Categories.GDIP.NewPBitmap := {}
	Gui1.Categories.GDIP.NewPBitmap.List := [ "Width" , "Height" ]
	Gui1.Categories.GDIP.NewPBitmap.WordList := [ "Width" , "Height" ]
	loop, % Gui1.Categories.GDIP.NewPBitmap.WordList.Length()	{
		Gui1.WordList.Push( Gui1.Categories.GDIP.NewPBitmap.WordList[ A_Index ] )
	}
	Gui1.Categories.GDIP.NewPBitmap.CallPath := "NewPBitmap_ClipboardString"
	Gui1.Categories.GDIP.NewPBitmap.HasParams := 1
	;######################
	Gui1.Categories.GDIP.NewPBitmap.Width := {}

	Gui1.Categories.GDIP.NewPBitmap.Width.List := [ "0" , "10" , "50" , "100" , "500" , "600" , "A_ScreenWidth" ]

	Gui1.Categories.GDIP.NewPBitmap.Width.WordList := [ "0" , "10" , "50" , "100" , "500" , "600" , "A_Screen_Width" ]
	loop, % Gui1.Categories.GDIP.NewPBitmap.Width.WordList.Length()	{
		Gui1.WordList.Push( Gui1.Categories.GDIP.NewPBitmap.Width.WordList[ A_Index ] )
	}
	Gui1.Categories.GDIP.NewPBitmap.Width.Header := "Width"
	Gui1.Categories.GDIP.NewPBitmap.Width.HasParams := 0

	;######################
	Gui1.Categories.GDIP.NewPBitmap.Height := {}

	Gui1.Categories.GDIP.NewPBitmap.Height.List := [ "0" , "10" , "50" , "100" , "500" , "600" , "A_ScreenHeight" ]
	Gui1.Categories.GDIP.NewPBitmap.Height.WordList := [ "0" , "10" , "50" , "100" , "500" , "600" , "A_Screen_Height" ]
	loop, % Gui1.Categories.GDIP.NewPBitmap.Height.WordList.Length()	{
		Gui1.WordList.Push( Gui1.Categories.GDIP.NewPBitmap.Height.WordList[ A_Index ] )
	}

	;~ MsgBox, % Gui1.Categories.GDIP.NewPBtimap.List[ 2 ]


	Gui1.Categories.GDIP.NewPBitmap.Height.Header := "Height"
	Gui1.Categories.GDIP.NewPBitmap.Height.HasParams := 0
	;######################
	;***************************************************
	Gui1.Categories.GDIP.NewHBitmap := {}
	Gui1.Categories.GDIP.NewHBitmap.List := []
	Gui1.Categories.GDIP.NewHBitmap.WordList := []

	Gui1.Categories.GDIP.NewHBitmap.HasParams := 1

	;~ Gui1.Categories.GDIP.NewHBtimap.CallPath := "NewHBitmap_ClipboardString"
	;***************************************************
	Gui1.Categories.GDIP.NewPen := {}
	Gui1.Categories.GDIP.NewPen.List := [ "Color" , "Thickness" ]
	Gui1.Categories.GDIP.NewPen.WordList := [ "Color" , "Thickness" ]
	loop, % Gui1.Categories.GDIP.NewPen.WordList.Length()	{
		Gui1.WordList.Push( Gui1.Categories.GDIP.NewPen.WordList[ A_Index ] )
	}
	Gui1.Categories.GDIP.NewPen.CallPath := "NewPBitmap_ClipboardString"
	Gui1.Categories.GDIP.NewPen.HasParams := 1
	;######################
	cc := Gui1.Categories.GDIP.NewPen.Color := {}
	cc.List := [ "0xFFFFFFFF" , "0xFF000000" ]
	cc.WordList := [ "White" , "Black" ]
	loop, % cc.WordList.Length()	{
		Gui1.WordList.Push( cc.WordList[ A_Index ] )
	}
	cc.Header := "Color"
	cc.HasParams := 0
	;######################
	cc := Gui1.Categories.GDIP.NewPen.Thickness := {}
	cc.List := [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ]
	cc.WordList := [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ]
	loop, % cc.WordList.Length()	{
		Gui1.WordList.Push( cc.WordList[ A_Index ] )
	}
	cc.Header := "Pen Thickness"
	cc.HasParams := 0
	;######################

}
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;*****		       New Section             *****;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;



DrawWindow( Gui1 ){
	if( Gui1.Busy )
		return
	Gui1.Busy := 1
	
	Gui1.UpdateSettings( , 1 )
	Gui1.ClearWindow( AutoUpdate := 0 )
	;~ Gui1.PaintBackground( { Color: "0x66000000" , X: 2 , Y: 2 , W: Gui1.W - 4 , H: Gui1.H - 4 , Round: 10 } , AutoUpdate := 0 ) 
	Gui1.DrawBitmap( HB_BITMAP_MAKER( ScaleFactor := 1 ) , { X: 0 , Y: 0 , W: 500 , H: 600 } , dispose := 1 , AutoUpdate := 0 )
	
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		
		
		if( Gui1.PressedControlHwnd = cc.Hwnd ){
			Gui1.DrawBitmap( cc.Bitmaps.Pressed.pBitmap , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}else if( Gui1.HoveredControlHwnd = cc.Hwnd ){
			Gui1.DrawBitmap( cc.Bitmaps.Hover.pBitmap , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}else{
			Gui1.DrawBitmap( cc.Bitmaps.Default.pBitmap , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}
		
	}
	
	Gui1.UpdateWindow()
	sleep, 30
	Gui1.Busy := 0
}




HB_BITMAP_MAKER( ScaleFactor := 1 ){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 500 * ScaleFactor , 600 * ScaleFactor ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	;~ Brush := Gdip_BrushCreateSolid( "0xFF004444" ) , Gdip_FillRectangle( G , Brush , -10 * ScaleFactor , -10 * ScaleFactor , 538 * ScaleFactor , 670 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x9912161A" ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 180 * ScaleFactor , 430 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 12 * ScaleFactor , 12 * ScaleFactor , 171 * ScaleFactor , 427 * ScaleFactor , "0x33A4A4A4" , "0x33060606" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 10 * ScaleFactor , 10 * ScaleFactor , 180 * ScaleFactor , 430 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	;MoveWindow Button { X: 50 , Y: 20 , W: 100 , H: 30 }
	Brush := Gdip_BrushCreateSolid( "0xFF333333" ) , Gdip_FillRoundedRectangle( G , Brush , 50 * ScaleFactor , 20 * ScaleFactor , 100 * ScaleFactor , 30 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Category" , "s" 15 * ScaleFactor " Center vCenter Bold c" Brush " x" 61 * ScaleFactor " y" 23 * ScaleFactor  , "Segoe UI" , 80 * ScaleFactor , 30 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFacacac" ) , Gdip_TextToGraphics( G , "Category" , "s" 15 * ScaleFactor " Center vCenter Bold c" Brush " x" 60 * ScaleFactor " y" 21 * ScaleFactor  , "Segoe UI" , 80 * ScaleFactor , 30 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	;Panel bg
	Brush := Gdip_BrushCreateSolid( "0xFF333333" ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 55 * ScaleFactor , 120 * ScaleFactor , 330 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	;back button	{ X: 20 , Y: 25 , W: 20 , H: 20 }
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 20 * ScaleFactor , 25 * ScaleFactor , 20 * ScaleFactor , 20 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	;close button { X: 160 , Y: 25 , W: 20 , H: 20 }
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 160 * ScaleFactor , 25 * ScaleFactor , 20 * ScaleFactor , 20 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	;panel 1
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 60 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 80 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 100 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 120 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 140 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 160 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	;Bottom button panel bg
	;~ Brush := Gdip_BrushCreateSolid( "0xFF333333" ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 390 * ScaleFactor , 120 * ScaleFactor , 40 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	;Side button Panel bg { X: 150 , Y: 60 , W: 30 , H: 30 }
	Brush := Gdip_BrushCreateSolid( "0xFF333333" ) , Gdip_FillRoundedRectangle( G , Brush , 145 * ScaleFactor , 55 * ScaleFactor , 40 * ScaleFactor , 375 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 150 * ScaleFactor , 60 * ScaleFactor , 30 * ScaleFactor , 30 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 150 * ScaleFactor , 95 * ScaleFactor , 30 * ScaleFactor , 30 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 150 * ScaleFactor , 255 * ScaleFactor , 30 * ScaleFactor , 170 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 24 * ScaleFactor , 395 * ScaleFactor , 30 * ScaleFactor , 30 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 64 * ScaleFactor , 395 * ScaleFactor , 30 * ScaleFactor , 30 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 104 * ScaleFactor , 395 * ScaleFactor , 30 * ScaleFactor , 30 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 180 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 200 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 220 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 240 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 260 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 280 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 300 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 320 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF12161A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 340 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 25 * ScaleFactor , 360 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFaaaaaa" ) , Gdip_TextToGraphics( G , "G_D_I_P" , "s" 12 * ScaleFactor " Center vCenter Bold c" Brush " x" 25 * ScaleFactor " y" 61 * ScaleFactor  , "Calibri" , 110 * ScaleFactor , 20 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFaaaaaa" ) , Gdip_TextToGraphics( G , "Functions" , "s" 12 * ScaleFactor " Center vCenter Bold c" Brush " x" 25 * ScaleFactor " y" 82 * ScaleFactor  , "Calibri" , 110 * ScaleFactor , 20 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFaaaaaa" ) , Gdip_TextToGraphics( G , "Classes" , "s" 12 * ScaleFactor " Center vCenter Bold c" Brush " x" 25 * ScaleFactor " y" 102 * ScaleFactor  , "Calibri" , 110 * ScaleFactor , 20 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Pen := Gdip_CreatePen( "0x993399FF" , 1 ) , Gdip_DrawRoundedRectangle( G , Pen , 25 * ScaleFactor , 60 * ScaleFactor , 110 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0x223399FF" ) , Gdip_FillRectangle( G , Brush , 30 * ScaleFactor , 63 * ScaleFactor , 100 * ScaleFactor , 7 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x22000000" ) , Gdip_FillRectangle( G , Brush , 30 * ScaleFactor , 70 * ScaleFactor , 100 * ScaleFactor , 7 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}



HBCustomButton(){
	local MyButtonDesign := {}
	MyButtonDesign.All := {}
	MyButtonDesign.Default := {}
	MyButtonDesign.Hover := {}
	MyButtonDesign.Pressed := {}
	;********************************
	;All
	MyButtonDesign.All.W := 35 , MyButtonDesign.All.H := 30 , MyButtonDesign.All.Text := "S" , MyButtonDesign.All.H := "0x00000000" , MyButtonDesign.All.TextBottomColor2 := "0x00000000" , MyButtonDesign.All.BackgroundColor := "0xFF22262A" , MyButtonDesign.All.ButtonAddGlossy := "0"
	;********************************
	;Default
	MyButtonDesign.Default.W := 35 , MyButtonDesign.Default.H := 30 , MyButtonDesign.Default.Text := "S" , MyButtonDesign.Default.Font := "Arial" , MyButtonDesign.Default.FontOptions := " Bold Center vCenter " , MyButtonDesign.Default.FontSize := "12" , MyButtonDesign.Default.H := "0x00000000" , MyButtonDesign.Default.TextBottomColor2 := "0x00000000" , MyButtonDesign.Default.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Default.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Default.TextOffsetX := "0" , MyButtonDesign.Default.TextOffsetY := "0" , MyButtonDesign.Default.TextOffsetW := "0" , MyButtonDesign.Default.TextOffsetH := "0" , MyButtonDesign.Default.BackgroundColor := "0xFF22262A" , MyButtonDesign.Default.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Default.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Default.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Default.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Default.ButtonMainColor1 := "0xFF272C32" , MyButtonDesign.Default.ButtonMainColor2 := "0xFF272C32" , MyButtonDesign.Default.ButtonAddGlossy := "0" , MyButtonDesign.Default.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Default.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Default.GlossBottomColor := "33000000"
	;********************************
	;Hover
	MyButtonDesign.Hover.W := 35 , MyButtonDesign.Hover.H := 30 , MyButtonDesign.Hover.Text := "S" , MyButtonDesign.Hover.Font := "Arial" , MyButtonDesign.Hover.FontOptions := " Bold Center vCenter " , MyButtonDesign.Hover.FontSize := "12" , MyButtonDesign.Hover.H := "0x00000000" , MyButtonDesign.Hover.TextBottomColor2 := "0x00000000" , MyButtonDesign.Hover.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextOffsetX := "0" , MyButtonDesign.Hover.TextOffsetY := "0" , MyButtonDesign.Hover.TextOffsetW := "0" , MyButtonDesign.Hover.TextOffsetH := "0" , MyButtonDesign.Hover.BackgroundColor := "0xFF22262A" , MyButtonDesign.Hover.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Hover.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Hover.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Hover.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Hover.ButtonMainColor1 := "0xFF373C42" , MyButtonDesign.Hover.ButtonMainColor2 := "0xFF1F1FED" , MyButtonDesign.Hover.ButtonAddGlossy := "0" , MyButtonDesign.Hover.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Hover.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Hover.GlossBottomColor := "33000000"
	;********************************
	;Pressed
	MyButtonDesign.Pressed.W := 35 , MyButtonDesign.Pressed.H := 30 , MyButtonDesign.Pressed.Text := "S" , MyButtonDesign.Pressed.Font := "Arial" , MyButtonDesign.Pressed.FontOptions := " Bold Center vCenter " , MyButtonDesign.Pressed.FontSize := "12" , MyButtonDesign.Pressed.H := "0x6600ff00" , MyButtonDesign.Pressed.TextBottomColor2 := "0x00000000" , MyButtonDesign.Pressed.TextTopColor1 := "0xFF777777" , MyButtonDesign.Pressed.TextTopColor2 := "0xFFffffff" , MyButtonDesign.Pressed.TextOffsetX := "-1" , MyButtonDesign.Pressed.TextOffsetY := "-2" , MyButtonDesign.Pressed.TextOffsetW := "0" , MyButtonDesign.Pressed.TextOffsetH := "0" , MyButtonDesign.Pressed.BackgroundColor := "0xFF22262A" , MyButtonDesign.Pressed.ButtonOuterBorderColor := "0xFF62666a" , MyButtonDesign.Pressed.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Pressed.ButtonInnerBorderColor1 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonInnerBorderColor2 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonMainColor1 := "0x33FF000E" , MyButtonDesign.Pressed.ButtonMainColor2 := "0x33FF000E" , MyButtonDesign.Pressed.ButtonAddGlossy := "0" , MyButtonDesign.Pressed.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Pressed.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Pressed.GlossBottomColor := "33000000"
	;********************************
	
	return MyButtonDesign
}




/*
HBCustomButton(){
	local MyButtonDesign := {}
	MyButtonDesign.All := {}
	MyButtonDesign.Default := {}
	MyButtonDesign.Hover := {}
	MyButtonDesign.Pressed := {}
	;********************************
	;All
	MyButtonDesign.All.W := 35 , MyButtonDesign.All.H := 30 , MyButtonDesign.All.Text := "S" , MyButtonDesign.All.H := "0x00000000" , MyButtonDesign.All.TextBottomColor2 := "0x00000000" , MyButtonDesign.All.BackgroundColor := "0xFF22262A" , MyButtonDesign.All.ButtonAddGlossy := "0"
	;********************************
	;Default
	MyButtonDesign.Default.W := 35 , MyButtonDesign.Default.H := 30 , MyButtonDesign.Default.Text := "S" , MyButtonDesign.Default.Font := "Arial" , MyButtonDesign.Default.FontOptions := " Bold Center vCenter " , MyButtonDesign.Default.FontSize := "12" , MyButtonDesign.Default.H := "0x00000000" , MyButtonDesign.Default.TextBottomColor2 := "0x00000000" , MyButtonDesign.Default.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Default.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Default.TextOffsetX := "0" , MyButtonDesign.Default.TextOffsetY := "0" , MyButtonDesign.Default.TextOffsetW := "0" , MyButtonDesign.Default.TextOffsetH := "0" , MyButtonDesign.Default.BackgroundColor := "0xFF22262A" , MyButtonDesign.Default.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Default.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Default.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Default.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Default.ButtonMainColor1 := "0xFF272C32" , MyButtonDesign.Default.ButtonMainColor2 := "0xFF272C32" , MyButtonDesign.Default.ButtonAddGlossy := "0" , MyButtonDesign.Default.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Default.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Default.GlossBottomColor := "33000000"
	;********************************
	;Hover
	MyButtonDesign.Hover.W := 35 , MyButtonDesign.Hover.H := 30 , MyButtonDesign.Hover.Text := "S" , MyButtonDesign.Hover.Font := "Arial" , MyButtonDesign.Hover.FontOptions := " Bold Center vCenter " , MyButtonDesign.Hover.FontSize := "12" , MyButtonDesign.Hover.H := "0x00000000" , MyButtonDesign.Hover.TextBottomColor2 := "0x00000000" , MyButtonDesign.Hover.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextOffsetX := "0" , MyButtonDesign.Hover.TextOffsetY := "0" , MyButtonDesign.Hover.TextOffsetW := "0" , MyButtonDesign.Hover.TextOffsetH := "0" , MyButtonDesign.Hover.BackgroundColor := "0xFF22262A" , MyButtonDesign.Hover.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Hover.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Hover.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Hover.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Hover.ButtonMainColor1 := "0xFF373C42" , MyButtonDesign.Hover.ButtonMainColor2 := "0xFF1F1FED" , MyButtonDesign.Hover.ButtonAddGlossy := "0" , MyButtonDesign.Hover.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Hover.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Hover.GlossBottomColor := "33000000"
	;********************************
	;Pressed
	MyButtonDesign.Pressed.W := 35 , MyButtonDesign.Pressed.H := 30 , MyButtonDesign.Pressed.Text := "S" , MyButtonDesign.Pressed.Font := "Arial" , MyButtonDesign.Pressed.FontOptions := " Bold Center vCenter " , MyButtonDesign.Pressed.FontSize := "12" , MyButtonDesign.Pressed.H := "0x00000000" , MyButtonDesign.Pressed.TextBottomColor2 := "0x00000000" , MyButtonDesign.Pressed.TextTopColor1 := "0xFF000000" , MyButtonDesign.Pressed.TextTopColor2 := "0xFF000000" , MyButtonDesign.Pressed.TextOffsetX := "-1" , MyButtonDesign.Pressed.TextOffsetY := "-2" , MyButtonDesign.Pressed.TextOffsetW := "0" , MyButtonDesign.Pressed.TextOffsetH := "0" , MyButtonDesign.Pressed.BackgroundColor := "0xFF22262A" , MyButtonDesign.Pressed.ButtonOuterBorderColor := "0xFF62666a" , MyButtonDesign.Pressed.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Pressed.ButtonInnerBorderColor1 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonInnerBorderColor2 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonMainColor1 := "0xFF22262a" , MyButtonDesign.Pressed.ButtonMainColor2 := "0x9900F807" , MyButtonDesign.Pressed.ButtonAddGlossy := "0" , MyButtonDesign.Pressed.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Pressed.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Pressed.GlossBottomColor := "33000000"
	;********************************
	
	return MyButtonDesign
}
*/



;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************
Class GuiButtonType1	{

	static List := [ "Default" , "Hover" , "Pressed" ]
	
	_CreatePressedBitmap(){
		
		local arr := [] , Bitmap := {} , fObj := This.CurrentBitmapData.Pressed
		
		Bitmap.pBitmap := Gdip_CreateBitmap( fObj.W , fObj.H ) , G := Gdip_GraphicsFromImage( Bitmap.pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
		
		Brush := Gdip_BrushCreateSolid( fObj.BackgroundColor ) , Gdip_FillRectangle( G , Brush , -1 , -1 , fObj.W+2 , fObj.H+2 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_BrushCreateSolid( fObj.ButtonOuterBorderColor ) , Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , fObj.W-7 , fObj.H-7 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , fObj.W , fObj.H , fObj.ButtonInnerBorderColor1 , fObj.ButtonInnerBorderColor2 , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , fObj.W-5 , fObj.H-8 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , fObj.W-7 , fObj.H-10 , fObj.ButtonMainColor1 , fObj.ButtonMainColor2 , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 5 , 5 , fObj.W-11 , fObj.H-12 , 5 ) , Gdip_DeleteBrush( Brush )
			
		Brush := Gdip_CreateLineBrushFromRect( 0 , 2 , fObj.W , fObj.H , fObj.TextBottomColor1 , fObj.TextBottomColor2 , 1 , 1 )
		
		arr := [ { X: -1 , Y: -1 } , { X: 0 , Y: -1 } , { X: 1 , Y: -1 } , { X: -1 , Y: 0 } , { X: 1 , Y: 0 } , { X: -1 , Y: 1 } , { X: 0 , Y: 1 } , { X: 1 , Y: 1 } ]
		
		Loop, % 8
			
			Gdip_TextToGraphics( G , fObj.Text , "s" fObj.FontSize " " fObj.FontOptions " c" Brush " x" 1 + arr[A_Index].X + fObj.TextOffsetX " y" 3 + arr[A_Index].Y + fObj.TextOffsetY , fObj.Font , fObj.W + fObj.TextOffsetW , fObj.H + fObj.TextOffsetH )
	
		Brush := Gdip_CreateLineBrushFromRect( 0 , 2 , fObj.W , fObj.H , fObj.TextTopColor1 , fObj.TextTopColor2 , 1 , 1 )
		
		Gdip_TextToGraphics( G , fObj.Text , "s" fObj.FontSize " " fObj.FontOptions " c" Brush " x" 1 + fObj.TextOffsetX " y" 3 + fObj.TextOffsetY , fObj.Font , fObj.W + fObj.TextOffsetW , fObj.H + fObj.TextOffsetH )
	
	if( fObj.ButtonAddGlossy ){
		
		Brush := Gdip_BrushCreateSolid( fObj.GlossTopColor ) , Gdip_FillRectangle( G , Brush , 5 , 10 , fObj.W-11 , ( fObj.H / 2 ) - 10   ) , Gdip_DeleteBrush( Brush )

		Brush := Gdip_BrushCreateSolid( fObj.GlossTopAccentColor ) , Gdip_FillRectangle( G , Brush , 10 , 12 , fObj.W-21 , fObj.H / 15 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_BrushCreateSolid( fObj.GlossBottomColor ) , Gdip_FillRectangle( G , Brush , 5  , 10 + ( fObj.H / 2 ) - 10 , fObj.W-11 , ( fObj.H / 2 ) - 7 ) , Gdip_DeleteBrush( Brush )
				
	}

		Gdip_DeleteGraphics( G )
		
		Bitmap.hBitmap := Gdip_CreateHBITMAPFromBitmap( Bitmap.pBitmap )
		
		return Bitmap
	}
	
	_CreateHoverBitmap(){
		
		local arr := [] , Bitmap := {} , fObj := This.CurrentBitmapData.Hover
		
		Bitmap.pBitmap := Gdip_CreateBitmap( fObj.W , fObj.H ) , G := Gdip_GraphicsFromImage( Bitmap.pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
		
		Brush := Gdip_BrushCreateSolid( fObj.BackgroundColor ) , Gdip_FillRectangle( G , Brush , -1 , -1 , fObj.W+2 , fObj.H+2 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_BrushCreateSolid( fObj.ButtonOuterBorderColor ) , Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , fObj.W-5 , fObj.H-7 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_BrushCreateSolid( fObj.ButtonCenterBorderColor ) , Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , fObj.W-7 , fObj.H-9 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , fObj.W , fObj.H-10 , fObj.ButtonInnerBorderColor1 , fObj.ButtonInnerBorderColor2 , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 4 , 5 , fObj.W-9 , fObj.H-11 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_CreateLineBrushFromRect( 5 , 7 , fObj.W-11 , fObj.H-14 , fObj.ButtonMainColor1 , fObj.ButtonMainColor2 , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 5 , 7 , fObj.W-11 , fObj.H-14 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_CreateLineBrushFromRect( 0 , 2 , fObj.W , fObj.H , fObj.TextBottomColor1 , fObj.TextBottomColor2 , 1 , 1 )
		
		arr := [ { X: -1 , Y: -1 } , { X: 0 , Y: -1 } , { X: 1 , Y: -1 } , { X: -1 , Y: 0 } , { X: 1 , Y: 0 } , { X: -1 , Y: 1 } , { X: 0 , Y: 1 } , { X: 1 , Y: 1 } ]
		
		Loop, % 8
			
			Gdip_TextToGraphics( G , fObj.Text , "s" fObj.FontSize " " fObj.FontOptions " c" Brush " x" 0 + arr[A_Index].X + fObj.TextOffsetX " y" 2 + arr[A_Index].Y + fObj.TextOffsetY , fObj.Font , fObj.W + fObj.TextOffsetW , fObj.H + fObj.TextOffsetH )
	
		Brush := Gdip_CreateLineBrushFromRect( 0 , 2 , fObj.W , fObj.H , fObj.TextTopColor1 , fObj.TextTopColor2 , 1 , 1 )
		
		Gdip_TextToGraphics( G , fObj.Text , "s" fObj.FontSize " " fObj.FontOptions " c" Brush " x" 0 + fObj.TextOffsetX " y" 2 + fObj.TextOffsetY , fObj.Font , fObj.W + fObj.TextOffsetW , fObj.H + fObj.TextOffsetH )
	
		if( fObj.ButtonAddGlossy = 1 ){
			
			Brush := Gdip_BrushCreateSolid( fObj.GlossTopColor ) , Gdip_FillRectangle( G , Brush , 6 , 10 , fObj.W-13 , ( fObj.H / 2 ) - 10   ) , Gdip_DeleteBrush( Brush )
			
			Brush := Gdip_BrushCreateSolid( fObj.GlossTopAccentColor ) , Gdip_FillRectangle( G , Brush , 10 , 12 , fObj.W-21 , fObj.H / 15 ) , Gdip_DeleteBrush( Brush )
			
			Brush := Gdip_BrushCreateSolid( fObj.GlossBottomColor ) , Gdip_FillRectangle( G , Brush , 6  , 10 + ( fObj.H / 2 ) - 10 , fObj.W-13 , ( fObj.H / 2 ) - 7 ) , Gdip_DeleteBrush( Brush )
					
		}
	
		Gdip_DeleteGraphics( G )
		
		Bitmap.hBitmap := Gdip_CreateHBITMAPFromBitmap( Bitmap.pBitmap )
		
		return Bitmap
		
	}
	
	_CreateDefaultBitmap(){
		
		local arr := [] , Bitmap := {} , fObj := This.CurrentBitmapData.Default
		
		Bitmap.pBitmap := Gdip_CreateBitmap( fObj.W , fObj.H ) , G := Gdip_GraphicsFromImage( Bitmap.pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	
		Brush := Gdip_BrushCreateSolid( fObj.BackgroundColor ) , Gdip_FillRectangle( G , Brush , -1 , -1 , fObj.W+2 , fObj.H+2 ) , Gdip_DeleteBrush( Brush )
	
		Brush := Gdip_BrushCreateSolid( fObj.ButtonOuterBorderColor ) , Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , fObj.W-5 , fObj.H-7 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_BrushCreateSolid( fObj.ButtonCenterBorderColor ) , Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , fObj.W-7 , fObj.H-9 , 5 ) , Gdip_DeleteBrush( Brush )
	
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , fObj.W , fObj.H-10 , fObj.ButtonInnerBorderColor1 , fObj.ButtonInnerBorderColor2 , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 4 , 5 , fObj.W-9 , fObj.H-11 , 5 ) , Gdip_DeleteBrush( Brush )
	
		Brush := Gdip_CreateLineBrushFromRect( 5 , 7 , fObj.W-11 , fObj.H-14 , fObj.ButtonMainColor1 , fObj.ButtonMainColor2 , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 5 , 7 , fObj.W-11 , fObj.H-14 , 5 ) , Gdip_DeleteBrush( Brush )
		
		Brush := Gdip_CreateLineBrushFromRect( 0 , 2 , fObj.W , fObj.H , fObj.TextBottomColor1 , fObj.TextBottomColor2 , 1 , 1 )
		
		arr := [ { X: -1 , Y: -1 } , { X: 0 , Y: -1 } , { X: 1 , Y: -1 } , { X: -1 , Y: 0 } , { X: 1 , Y: 0 } , { X: -1 , Y: 1 } , { X: 0 , Y: 1 } , { X: 1 , Y: 1 } ]
		
		Loop, % 8
			
			Gdip_TextToGraphics( G , fObj.Text , "s" fObj.FontSize " " fObj.FontOptions " c" Brush " x" 0 + arr[A_Index].X + fObj.TextOffsetX " y" 2 + arr[A_Index].Y + fObj.TextOffsetY , fObj.Font , fObj.W + fObj.TextOffsetW , fObj.H + fObj.TextOffsetH )
	
		Brush := Gdip_CreateLineBrushFromRect( 0 , 2 , fObj.W , fObj.H , fObj.TextTopColor1 , fObj.TextTopColor2 , 1 , 1 )
		
		Gdip_TextToGraphics( G , fObj.Text , "s" fObj.FontSize " " fObj.FontOptions " c" Brush " x" 0 + fObj.TextOffsetX " y" 2 + fObj.TextOffsetY , fObj.Font , fObj.W + fObj.TextOffsetW , fObj.H + fObj.TextOffsetH )
	
		if( fObj.ButtonAddGlossy ){
		
			Brush := Gdip_BrushCreateSolid( fObj.GlossTopColor ) , Gdip_FillRectangle( G , Brush , 6 , 10 , fObj.W-13 , ( fObj.H / 2 ) - 10   ) , Gdip_DeleteBrush( Brush )
			
			Brush := Gdip_BrushCreateSolid( fObj.GlossTopAccentColor ) , Gdip_FillRectangle( G , Brush , 10 , 12 , fObj.W-21 , fObj.H / 15 ) , Gdip_DeleteBrush( Brush )
			
			Brush := Gdip_BrushCreateSolid( fObj.GlossBottomColor ) , Gdip_FillRectangle( G , Brush , 6  , 10 + ( fObj.H / 2 ) - 10 , fObj.W-13 , ( fObj.H / 2 ) - 7 ) , Gdip_DeleteBrush( Brush )
				
		}
	
		Gdip_DeleteGraphics( G )
		
		Bitmap.hBitmap := Gdip_CreateHBITMAPFromBitmap( Bitmap.pBitmap )
		
		return Bitmap
		
	}
	
	_GetMasterDefaultValues(){ ;Default State
		
		local Default := {}
		
		Default.pBitmap := "" 
		, Default.hBitmap := ""
		, Default.Font := "Arial"
		, Default.FontOptions := " Bold Center vCenter "
		, Default.FontSize := "12"
		, Default.Text := "Button"
		, Default.W := 10
		, Default.H := 10
		, Default.TextBottomColor1 := "0x0002112F"
		, Default.TextBottomColor2 := Default.TextBottomColor1
		, Default.TextTopColor1 := "0xFFFFFFFF"
		, Default.TextTopColor2 := "0xFF000000"
		, Default.TextOffsetX := 0
		, Default.TextOffsetY := 0
		, Default.TextOffsetW := 0
		, Default.TextOffsetH := 0
		, Default.BackgroundColor := "0xFF22262A"
		, Default.ButtonOuterBorderColor := "0xFF161B1F"	
		, Default.ButtonCenterBorderColor := "0xFF262B2F"	
		, Default.ButtonInnerBorderColor1 := "0xFF3F444A"
		, Default.ButtonInnerBorderColor2 := "0xFF24292D"
		, Default.ButtonMainColor1 := "0xFF272C32"
		, Default.ButtonMainColor2 := "" Default.ButtonMainColor1
		, Default.ButtonAddGlossy := 0
		, Default.GlossTopColor := "0x11FFFFFF"
		, Default.GlossTopAccentColor := "0x05FFFFFF"	
		, Default.GlossBottomColor := "0x33000000"
		
		return Default
		
	}
	
	_GetMasterHoverValues(){ ;Hover State
		
		local Default := {}
		
		Default.pBitmap := ""
		, Default.hBitmap := ""
		, Default.Font := "Arial"
		, Default.FontOptions := " Bold Center vCenter "
		, Default.FontSize := "12"
		, Default.Text := "Button"
		, Default.W := 10
		, Default.H := 10
		, Default.TextBottomColor1 := "0x0002112F"
		, Default.TextBottomColor2 := Default.TextBottomColor1
		, Default.TextTopColor1 := "0xFFFFFFFF"
		, Default.TextTopColor2 := "0xFF000000"
		, Default.TextOffsetX := 0
		, Default.TextOffsetY := 0
		, Default.TextOffsetW := 0
		, Default.TextOffsetH := 0
		, Default.BackgroundColor := "0xFF22262A"
		, Default.ButtonOuterBorderColor := "0xFF161B1F"	
		, Default.ButtonCenterBorderColor := "0xFF262B2F"	
		, Default.ButtonInnerBorderColor1 := "0xFF3F444A"
		, Default.ButtonInnerBorderColor2 := "0xFF24292D"
		, Default.ButtonMainColor1 := "0xFF373C42"
		, Default.ButtonMainColor2 := "" Default.ButtonMainColor1
		, Default.ButtonAddGlossy := 0
		, Default.GlossTopColor := "0x11FFFFFF"
		, Default.GlossTopAccentColor := "0x05FFFFFF"	
		, Default.GlossBottomColor := "0x33000000"
		
		return Default
		
	}
	
	_GetMasterPressedValues(){ ;Pressed State
		
		local Default := {}
		
		Default.pBitmap := ""
		, Default.hBitmap := ""
		, Default.Font := "Arial"
		, Default.FontOptions := " Bold Center vCenter "
		, Default.FontSize := "12"
		, Default.Text := "Button"
		, Default.W := 10
		, Default.H := 10
		, Default.TextBottomColor1 := "0x0002112F"
		, Default.TextBottomColor2 := Default.TextBottomColor1
		, Default.TextTopColor1 := "0xFFFFFFFF"
		, Default.TextTopColor2 := "0xFF000000"
		, Default.TextOffsetX := 0
		, Default.TextOffsetY := 0
		, Default.TextOffsetW := 0
		, Default.TextOffsetH := 0
		, Default.BackgroundColor := "0xFF22262A"
		, Default.ButtonOuterBorderColor := "0xFF62666a"
		, Default.ButtonCenterBorderColor := "0xFF262B2F"	
		, Default.ButtonInnerBorderColor1 := "0xFF151A20"
		, Default.ButtonInnerBorderColor2 := "0xFF151A20"
		, Default.ButtonMainColor1 := "0xFF12161a"
		, Default.ButtonMainColor2 := "0xFF33383E"
		, Default.ButtonAddGlossy := 0
		, Default.GlossTopColor := "0x11FFFFFF"
		, Default.GlossTopAccentColor := "0x05FFFFFF"	
		, Default.GlossBottomColor := "0x33000000"
	
		return Default
		
	}
	
	SetSessionDefaults( All := "" , Default := "" , Hover := "" , Pressed := "" ){ ;Set the default values based on user input
		
		This.SessionBitmapData := {} 
		, This.Preset := 1
		, This.init := 0
		
		This._LoadDefaults("SessionBitmapData")
		
		This._SetSessionData( All , Default , Hover , Pressed )
		
	}
	
	_SetSessionData( All := "" , Default := "" , Hover := "" , Pressed := "" ){
		
		local index , k , v , i , j
	
		if( IsObject( All ) ){
			
			Loop, % GuiButtonType1.List.Length()	{
				index := A_Index
				For k , v in All
					This.SessionBitmapData[ GuiButtonType1.List[ index ] ][ k ] := v
			}
		}
		
		For k , v in GuiButtonType1.List
			if( isObject( %v% ) )
				For i , j in %v%
					This.SessionBitmapData[ GuiButtonType1.List[ k ] ][ i ] := j
				
	}
	
	_LoadDefaults( input := "" ){
		
		This.CurrentBitmapData := "" , This.CurrentBitmapData := {}
			
		For k , v in This.SessionBitmapData
			This.CurrentBitmapData[k] := {}
		
		This[ input ].Default := This._GetMasterDefaultValues()
		, This[ input ].Hover := This._GetMasterHoverValues()
		, This[ input ].Pressed := This._GetMasterPressedValues()
		
	}
	
	_SetCurrentBitmapDataFromSessionData(){
		
		local k , v , i , j
			
		This.CurrentBitmapData := "" , This.CurrentBitmapData := {}
			
		For k , v in This.SessionBitmapData
		{
			This.CurrentBitmapData[k] := {}
			
			For i , j in This.SessionBitmapData[k]
				
				This.CurrentBitmapData[k][i] := j

		}
		
	}
	
	_UpdateCurrentBitmapData( All := "" , Default := "" , Hover := "" , Pressed := "" ){
		
		local k , v , i , j
		
		if( IsObject( All ) ){
			
			Loop, % GuiButtonType1.List.Length()	{
				
				index := A_Index
			
				For k , v in All
					
					This.CurrentBitmapData[ GuiButtonType1.List[ index ] ][ k ] := v
					
			}
		}
		
		For k , v in GuiButtonType1.List
			
			if( isObject( %v% ) )
				
				For i , j in %v%
					
					This.CurrentBitmapData[ GuiButtonType1.List[ k ] ][ i ] := j
				
	}
	
	_UpdateInstanceData( obj := ""){
		
		For k , v in GuiButtonType1.List	
			
			This.CurrentBitmapData[v].Text := obj.Text
			, This.CurrentBitmapData[v].W := obj.W
			, This.CurrentBitmapData[v].H := obj.H
			
	}

	CreateButtonBitmapSet( obj := "" ,  All := "" , Default := "" , Hover := "" , Pressed := ""  ){ ;Create a new button
		
		local Bitmaps := {}
		
		if( This.Preset )
				
			This._SetCurrentBitmapDataFromSessionData()
			
		else
			
			This._LoadDefaults( "CurrentBitmapData" )
			
		This._UpdateCurrentBitmapData( All , Default , Hover , Pressed )
		
		This._UpdateInstanceData( obj )
		 
		Bitmaps.Default := This._CreateDefaultBitmap()
		, Bitmaps.Hover := This._CreateHoverBitmap()
		, Bitmaps.Pressed := This._CreatePressedBitmap()
		
		return Bitmaps
		
	}
	
}
;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************
;****************************************************************************************************************************************************************************************

class HB_ListBox_1	{
	Delete(){
		This.Window.DeleteWindow()
		This := ""
	}
	HideWindow(){
		This.Window.ClearWindow( 1 )
		This.Window.HideWindow()
		This.isHidden := 1
	}
	ShowWindow(){
		This.ShowWindow()
		This.DrawWindow()
		This.isHidden := 0
	}
	List[]{
		Get{
			if( This._List = "" )
				This._List := [ "A" , "B" , "C" ]
			
			;~ if( This.Panels ){
				;~ dd := This.SettingsData.PanelsData
				;~ x := This.ListBoxBackgroundX + This.MarginX
				;~ y := This.ListBoxBackgroundY + This.MarginY
				;~ w := This.ListBoxPanelWidth
				;~ h := This.ListBoxPanelHeight + dd.PanelGap
				;~ Loop, % This.Panels.Length	{
					;~ cc := This.Panels[ A_Index ]
					;~ cc.X := x 
					;~ cc.Y := y 
					;~ cc.W := w 
					;~ cc.H := h
					;~ GuiControl, % This.Window.Hwnd ":Move" , % cc.Hwnd , % "x" x " y" y " w" w " h" h
					;~ y += h
				;~ }
			;~ }
			return This._List
		}Set{
			This._List := value
			This._PanelWidth := ""
			This.PanelWidth := ""
			This._PanelHeight := ""
			This.PanelHeight := ""
			
			if( This.Panels ){
				dd := This.SettingsData.PanelsData
				x := This.ListBoxBackgroundX + This.MarginX
				y := This.ListBoxBackgroundY + This.MarginY
				w := This.ListBoxPanelWidth
				h := This.ListBoxPanelHeight + dd.PanelGap
				Loop, % This.Panels.Length()	{
					cc := This.Panels[ A_Index ]
					cc.X := x 
					cc.Y := y 
					cc.W := w 
					cc.H := h
					GuiControl, % This.Window.Hwnd ":Move" , % cc.Hwnd , % "x" x " y" y " w" w " h" h
					y += h
					
				}
			}
			if( This.NumberOfButtons ){
		
			x := This.ButtonPanelBackgroundX + This.MarginX
			y := This.ButtonPanelBackgroundY + This.MarginY
			w := This.ButtonPanelBackgroundWidth - 2 * This.MarginX
			h := ( This.ButtonPanelBackgroundHeight - ( ( This.NumberOfButtons + 1 ) * This.MarginY  ) ) / This.NumberOfButtons
			
			Loop, % This.NumberOfButtons	{
				index := A_Index
				for k , v in [ "x" , "y" , "w" , "h" ]	{
					This.Buttons[ Index ][ v ] := %v%
				}
				y += h + This.MarginY
			}
		}
		}
	}
	ListBoxPanelWidth[]{
		Get{
			if( This._PanelWidth = "" ){
				This._PanelWidth := This.SettingsData.PanelsData._GetStringSize( "Width" , This.List ) + This.SettingsData.PanelsData.PaddingX * 2
				if( This._PanelWidth > This.SettingsData.PanelsData.MaxWidth ){
					This._PanelWidth := This.SettingsData.PanelsData.MaxWidth
				}else if( This._PanelWidth < This.SettingsData.PanelsData.MinWidth ){
					This._PanelWidth := This.SettingsData.PanelsData.MinWidth
				}
			}
			return This._PanelWidth
		}Set{
			This._PanelWidth := ""
		}
	}
	ListBoxPanelHeight[]{
		Get{
			if( This._PanelHeight = "" ){
				This._PanelHeight := This.SettingsData.PanelsData._GetStringSize( "Height" , This.List ) + This.SettingsData.PanelsData.PaddingY * 2
				if( This._PanelHeight > This.SettingsData.PanelsData.MaxHeight )
					This._PanelHeight := This.SettingsData.PanelsData.MaxHeight
				else if( This._PanelHeight < This.SettingsData.PanelsData.MinHeight )
					This._PanelHeight := This.SettingsData.PanelsData.MinHeight
			}
			return This._PanelHeight
		}Set{
			This._PanelHeight := ""
		}
	}
	ListBoxBackgroundX[]{
		Get{
			return This.MainBackgroundX + This.MarginX
		}
	}
	ListBoxBackgroundY[]{
		Get{
			return This.MainBackgroundY + This.MarginY + 20
		}
	}
	ListBoxBackgroundWidth[]{
		Get{
			return This.ListBoxPanelWidth + 2 * This.MarginX
		}
	}
	ListBoxBackgroundHeight[]{
		Get{
			return ( This.SettingsData.PanelsData.MaxPanels * This.ListBoxPanelHeight ) + ( 2 * This.MarginY ) + ( ( This.SettingsData.PanelsData.MaxPanels - 1 ) * This.SettingsData.PanelsData.PanelGap )
		}
	}
	ButtonPanelBackgroundX[]{
		Get{
			return This.ListBoxBackgroundWidth + ( This.MarginX * 3 )
		}
	}
	ButtonPanelBackgroundY[]{
		Get{
			return This.MainBackgroundY + This.MarginY
		}
	}
	ButtonPanelBackgroundWidth[]{
		Get{
			return 35
		}
	}
	ButtonPanelBackgroundHeight[]{
		Get{
			return This.MainBackgroundHeight - 2 * This.MarginY
		}
	}
	MainBackgroundX[]{
		Get{
			return 5
		}	
	}
	MainBackgroundY[]{
		Get{
			return 20
		}	
	}
	MainBackgroundWidth[]{
		Get{
			return This.ListBoxBackgroundWidth + This.ButtonPanelBackgroundWidth + 3 * This.MarginX
		}	
	}
	MainBackgroundHeight[]{
		Get{
			return This.ListBoxBackgroundHeight + 2 * This.MarginY + 40
		}	
	}
	Scale[]{
		Get{
			if( This._Scale = "" )
				This._Scale := 1
			return This._Scale
		}Set{
			if( This._Scale = "" && This._Scale := value )
				return
			This._Scale := value
			This.DrawWindow()
		}
	}
	MarginX[]{
		Get{
			if( This._MarginX = "" )
				This._MarginX := 7
			return This._MarginX
		}Set{	
			This._MarginX := value
		}
	}
	MarginY[]{
		Get{
			if( This._MarginY = "" )
				This._MarginY := 5
			return This._MarginY
		}Set{	
			This._MarginY := value
		}
	}
	PageUpButtonX[]{
		Get{
			
			return This.ListBoxBackgroundX + 10
		}
	}
	PageUpButtonY[]{
		Get{
			return This.MainBackgroundY + This.MarginY 
		}
	}
	PageUpButtonWidth[]{
		Get{
			;~ ToolTip, % "Tip:`n" This.ListBoxBackgroundWidth - 20
			return This.ListBoxBackgroundWidth - 20
		}
	}
	PageUpButtonHeight[]{
		Get{
			;~ ToolTip, % "Tip:`n" This.ListBoxBackgroundY - This.PageUpButtonY + 40
			;~ return This.ListBoxBackgroundY - This.MainBackgroundY + 10
			return This.ListBoxBackgroundY - This.MainBackgroundY + 15
		}
	}
	
	PageDownButtonX[]{
		Get{
			
			return This.ListBoxBackgroundX + 10
		}
	}
	PageDownButtonY[]{
		Get{
			return This.ListBoxBackgroundY + This.ListBoxBackgroundHeight - 10
		}
	}
	PageDownButtonWidth[]{
		Get{
			;~ ToolTip, % "Tip:`n" This.ListBoxBackgroundWidth - 20
			return This.ListBoxBackgroundWidth - 20
		}
	}
	PageDownButtonHeight[]{
		Get{
			;~ ToolTip, % "Tip:`n" This.ListBoxBackgroundY - This.MainBackgroundY 
			return This.ListBoxBackgroundY - This.MainBackgroundY + This.MarginY 
		}
	}
	
	NumberOfPanels[]{
		Get{
			return This.SettingsData.PanelsData.MaxPanels
		}Set{
			This.SettingsData.PanelsData.MaxPanels := value
		}
	}
	
	__New( List , x := 100 , y := 100 , boundFunction := "" , FontObj := "" , ButtonObj := "" , UseHotkey := 1 , Header := "" , PanelClickBypassHack := "" ){
		
		local w 
		local h 
		local cc 
		local bd 
		This.List := List
		
		This.Window := New PopUpWindow( { AutoShow: 1 , X: x , Y: y , W: A_ScreenWidth , H: A_ScreenHeight , Options: " -DPIScale +AlwaysOnTop +ToolWindow" } )
		
		This.isHidden := 0
		
		
		This.SelectedPanel := 1
		This.HoveredPanel := ""
		This.NumberOfPanels := This.SettingsData.PanelsData.MaxPanels
		
		
		This.HoverTimer := This._WatchLeaveHover.Bind( This )
		
		;*****************************************
		if( FontObj ){
			for k , v in FontObj	{
				if( This.SettingsData.PanelsData.HasKey( k ) )
					This.SettingsData.PanelsData[ k ] := FontObj[ k ]
				else if( k = "AccentColor" )
					This.SettingsData[ k ] := FontObj[ k ]
				else if( k = "MarginX" || k = "MarginY" ){
					This[ k ] := FontObj[ k ]
					SoundBeep
				}else if( k = "SelectedPanel" ){
					this.SelectedPanel := FontObj[ k ]
				}else if( k = "PanelClickBypassHack" ){
					This.PanelClickBypassHack := 1
				}
			}
			
		}
		;*****************************************
		This.Panels := []
		This.PanelHandles := []
		cc := This.SettingsData.PanelsData
		x := This.ListBoxBackgroundX + This.MarginX
		y := This.ListBoxBackgroundY + This.MarginY
		w := This.ListBoxPanelWidth
		h := This.ListBoxPanelHeight + cc.PanelGap
		
		Loop, % cc.MaxPanels	{
			dd := This.Panels[ A_Index ] := { X: x , Y: y , W: w , H: h }
			Gui, % This.Window.Hwnd ":Add" , Text , % "x" dd.X " y" dd.Y " w" dd.W " h" dd.H " hwndhwnd"
			dd.Hwnd := hwnd
			dd.Index := A_Index
			This.PanelHandles[ hwnd ] := dd
			bd := This._PanelClick.Bind( This , hwnd )
			GuiControl, % This.Window.Hwnd ":+G" , % hwnd , % bd
			y += h 
		}
		
		;*****************************************
		if( ButtonObj ){
			This.NumberOfButtons := ButtonObj.Length()
			This.Buttons := []
			
			x := This.ButtonPanelBackgroundX + This.MarginX
			y := This.ButtonPanelBackgroundY + This.MarginY
			w := This.ButtonPanelBackgroundWidth - 2 * This.MarginX
			h := ( This.ButtonPanelBackgroundHeight - ( ( This.NumberOfButtons + 1 ) * This.MarginY  ) ) / This.NumberOfButtons
			
			Loop, % This.NumberOfButtons	{
				
				This.Buttons[ A_Index ] := { X: x , Y: y , W: w , H: h }
				y += h + This.MarginY
				
			}
		}
		
		
		
		;*****************************************
		
		This.Brushes := {}
		This._CreateBrushesAndPens()
		
		;*****************************************
		
		This.DrawWindow()
		
		;*****************************************
		
		OnMessage( 0x200 , This._MouseHover.Bind( This , This.Window.Hwnd ) )
		
		if( boundFunction ){
			This.Function := boundFunction
		}
		
		if( UseHotkey ){
			This.UseHotkeys := 1
			;^^^^^^^^^^^^^^^^^^^^^^^^^^^
			;UP
			bd := This.UpArrowBind := This._IndexUp.Bind( This )
			This.UpArrowKeyActiveState := 1
			This.UpArrowKey := "~*Up"
			Hotkey, % This.UpArrowKey , % bd , On
			;^^^^^^^^^^^^^^^^^^^^^^^^^^^
			;Right
			bd := This.RightArrowBind := This._IndexUp.Bind( This )
			This.RightArrowKeyActiveState := 1
			This.RightArrowKey := "~*Right"
			Hotkey, % This.RightArrowKey , % bd , On
			;^^^^^^^^^^^^^^^^^^^^^^^^^^^
			;Down
			bd := This.DownArrowBind := This._IndexDown.Bind( This )
			This.DownArrowKeyActiveState := 1
			This.DownArrowKey := "~*Down"
			Hotkey, % This.DownArrowKey , % bd , On
			;^^^^^^^^^^^^^^^^^^^^^^^^^^^
			;Left
			bd := This.LeftArrowBind := This._IndexDown.Bind( This )
			This.LeftArrowKeyActiveState := 1
			This.LeftArrowKey := "~*Left"
			Hotkey, % This.LeftArrowKey , % bd , On
		}
		if( Header ){
			This.Header := Header
		}
		
	}
	_IndexUp(){
		local ctrl 
		local win
		local bd
		
		if( This.HasParent ){
			MouseGetPos,,, win , ctrl , 2
			if( ctrl = This.Window.Hwnd 
				|| win = This.Window.Hwnd 
				|| win = This.Parent.Hwnd 
				|| WinActive( "ahk_id " This.Window.Hwnd ) 
				|| WinActive( "ahk_id " This.Parent.Hwnd ) ){
				
			}
				
			
		}else{
			MouseGetPos,,, win , ctrl , 2
			if( ctrl = This.Window.Hwnd 
				|| win = This.Window.Hwnd 
				|| WinActive( "ahk_id " This.Window.Hwnd ) ){
				
				if( This.SelectedPanel > 1 ){
					--This.SelectedPanel
					if( This.Function ){
						This.Msg := "Selected Panel Changed"
						;~ bd := Func( This.Function ).Bind( This , hwnd  ) ;.call()
						This.DrawWindow()
						Func( This.Function ).Bind( This , hwnd  ).call()
						;~ SetTimer, % bd , -10
						
					}else{
						This.DrawWindow()
					}
					return 1
				}
			}
		}
		
		SoundBeep 888
	}
	_IndexDown(){
		local ctrl 
		local win
		local bd
		if( This.Msg ){
			bd := This._IndexDown.Bind( This )
			SetTimer, % bd , -30
			return 1
		}
		if( This.HasParent ){
			MouseGetPos,,, win , ctrl , 2
			if( ctrl = This.Window.Hwnd 
				|| win = This.Window.Hwnd 
				|| win = This.Parent.Hwnd 
				|| WinActive( "ahk_id " This.Window.Hwnd ) 
				|| WinActive( "ahk_id " This.Parent.Hwnd ) ){
				
			}
				
			
		}else{
			MouseGetPos,,, win , ctrl , 2
			if( ctrl = This.Window.Hwnd 
				|| win = This.Window.Hwnd 
				|| WinActive( "ahk_id " This.Window.Hwnd ) ){
				
				if( This.SelectedPanel < This.NumberOfPanels ){
					++This.SelectedPanel
					if( This.Function ){
						This.Msg := "Selected Panel Changed"
						;~ bd := Func( This.Function ).Bind( This , hwnd  ) ;.call()
						This.DrawWindow()
						Func( This.Function ).Bind( This , hwnd  ).call()
						;~ SetTimer, % bd , -10
						
					}else{
						This.DrawWindow()
					}
					return 1
				}
			}
		}
		
		SoundBeep 555
	}
	_PanelClick( hwnd ){
		local bd , tList 
		if( This.Msg ){
			bd := This._PanelClick.Bind( This )
			SetTimer, % bd , -30
			return
		}
		if( This.PanelHandles[ hwnd ].Index != This.SelectedPanel || This.PanelClickBypassHack ){
			This.SelectedPanel := This.PanelHandles[ hwnd ].Index 
			if( This.Function ){
				SoundBeep
				tList := This.List
				This.Msg := "PanelClick"
				;~ This.DrawWindow()
				bd := Func( This.Function ).Bind( This , hwnd  ) ;.call()
				SetTimer, % bd , -10
				This.DrawWindow()
			}
			;~ This.DrawWindow()
		}
	}
	
	DrawWindow(){
		if( This._Busy ){
			return
			
		}
		This._Busy := 1
		This.Window.ClearWindow( AutoUpdate := 0 )
		This.Window.DrawBitmap( This._WindowGraphics( This.Scale ) , { X: 0 , Y: 0 , W: This.Window.W , H: This.Window.H } , dispose := 1 , AutoUpdate := 1 )
		This._Busy := 0
	}
	
	
	
	
	_CreateBrusesAndPens(){
		
		
	}
	class SettingsData	{
		static AccentColor := "3388cc"
		static BackgroundColor := "0x6622262a"
		class ButtonData	{
			static NumberOfButtons := 6
			
		}
		class PanelsData	{
			static FontSize := 16
			static FontType := "Segoe UI"
			static FontOptions := "Center vCenter"
			static FontColorTop	:= "FFFFFF"
			static FontColorBottom	:= "000000"
			static MinWidth := 60
			static MinHeight := 20
			static MaxWidth := 1200
			static MaxHeight := 200
			static MaxPanels := 12
			static PanelGap := 2
			;~ static MarginX := 5
			;~ static MarginY := 5
			static PaddingX := 0
			static PaddingY := 2
			
			_GetStringSize( InputType := "Width" , List := "" ){
				local pBitmap := Gdip_CreateBitmap( 10 , 10 )
				local Graphics := Gdip_GraphicsFromImage( pBitmap )
				local Brush := Gdip_BrushCreateSolid( "0xFF000000")
				local OutputArray := ""
				local Output := 0
				local cc := This
				Gdip_SetSmoothingMode( Graphics , 2 )
				Loop, % List.Length()	{
					outputArray := StrSplit( Gdip_TextToGraphics( Graphics , List[ A_Index ] , " s" cc.Fontsize + 2 " c" Brush " " cc.FontOptions " x" 0 " y" 0 , cc.FontType , 10000 , 10000  ) , "|" , "|" )
					if( InputType = "Width" ){
						if( outputArray[ 3 ] > Output )
							Output := outputArray[ 3 ]
					}else if( InputType = "Height" ){
						if( outputArray[ 4 ] > Output )
							Output := outputArray[ 4 ]
					}
				}
				Gdip_DeleteBrush( Brush )
				Gdip_DeleteGraphics( Graphics )
				Gdip_DisposeImage( pBitmap )
				return ceil( Output )
			}
		}
		
	}
	
	_MouseHover( hwnd ){
		
		local x 
		local y 
		local ctrl 
		local timer 
		
		if( hwnd != This.Window.Hwnd || This.isHidden )
			return
		
		if( !This.HoveredPanel ){
			MouseGetPos,,,, ctrl , 2 
			if( This.PanelHandles[ ctrl ].Index && This.HoveredPanel := This.PanelHandles[ ctrl ].Index ){
				timer := This.HoverTimer
				SetTimer, % timer , 60
				This.DrawWindow()
			}
			
		}
	}
	
	_WatchLeaveHover(){
		local timer 
		MouseGetPos,,,, ctrl , 2
		if( This.HoveredPanel != This.PanelHandles[ ctrl ].Index  ){
			if( This.PanelHandles[ ctrl ].Index ){
				This.HoveredPanel := This.PanelHandles[ ctrl ].Index
				This.DrawWindow()
			}else{
				This.HoveredPanel := ""
				timer := This.HoverTimer
				SetTimer, % timer , Off
				This.DrawWindow()
			}
		}
	}
	
	_WindowGraphics( ScaleFactor := 1 ){
		local pBitmap := Gdip_CreateBitmap( This.Window.W * ScaleFactor , This.Window.H * ScaleFactor )
		local G := Gdip_GraphicsFromImage( pBitmap )
		local Brush
		local Pen
		local x 
		local y 
		local w 
		local h 
		local cc 
		local list 
		local tog 
		
		
		
		
		Gdip_SetSmoothingMode( G , 2 )
		
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	ARROW
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	This.MainBackground x/y/w/h
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		
		x := Ceil( This.MainBackgroundX * ScaleFactor )
		y := Ceil( This.MainBackgroundY * ScaleFactor )
		w := Ceil( This.MainBackgroundWidth * ScaleFactor )
		h := Ceil( This.MainBackgroundHeight * ScaleFactor )
		;~ Brush := Gdip_BrushCreateSolid( "0xFF22262a" )
		Brush := Gdip_BrushCreateSolid( This.SettingsData.BackgroundColor )
		Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 5 * ScaleFactor )
		Gdip_DeleteBrush( Brush )
		
		
		Brush := Gdip_CreateLineBrushFromRect( x , y , w , h , "0xFF" This.SettingsData.AccentColor , "0xFF000000" , 1 , 1 ) 
		, Pen := Gdip_CreatePenFromBrush( Brush , 2 ) 
		, Gdip_DeleteBrush( Brush ) 
		, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
		, Gdip_DeletePen( Pen )
		
		;~ ToolTip, % "Tip:`n" This.MainBackgroundHeight
		
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	Buttons Panel
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		x := Ceil( This.ButtonPanelBackgroundX * ScaleFactor )
		y := Ceil( This.ButtonPanelBackgroundY * ScaleFactor )
		w := Ceil( This.ButtonPanelBackgroundWidth * ScaleFactor )
		h := Ceil( This.ButtonPanelBackgroundHeight * ScaleFactor )
		
		Brush := Gdip_BrushCreateSolid( "0xFF12161A" )
		Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 5 * ScaleFactor )
		Gdip_DeleteBrush( Brush )
		Pen := Gdip_CreatePen( "0x99" This.SettingsData.AccentColor , 3 )
		, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
		, Gdip_DeletePen( Pen )
		Brush := Gdip_CreateLineBrushFromRect( x , y , w , h / 2 , "0x66000000" , "0x99FFFFFF" , 1 , 1 ) 
		, Pen := Gdip_CreatePenFromBrush( Brush , 1 ) 
		, Gdip_DeleteBrush( Brush ) 
		, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
		, Gdip_DeletePen( Pen )
		
		
		numButtons := This.SettingsData.ButtonData.NumberOfButtons
		x := This.ButtonPanelBackgroundX + 6 
		w := This.ButtonPanelBackgroundWidth - 12 
		h := This.ButtonPanelBackgroundHeight - This.MarginY * ( numButtons + 1 ) 
		h /= ceil( numButtons )
		
		y := This.ButtonPanelBackgroundY + This.MarginY 
		
		;~ Loop, % numButtons	{
			;~ Brush := Gdip_BrushCreateSolid( "0x66" This.SettingsData.AccentColor )
			;~ Gdip_FillRoundedRectangle( G , Brush , x * ScaleFactor , y * ScaleFactor , w * ScaleFactor , h * ScaleFactor , 3 * ScaleFactor )
			;~ Gdip_DeleteBrush( Brush )
			;~ y += This.MarginY + h
		;~ }
		
		Loop, % This.NumberOfButtons	{
			cc := This.Buttons[ A_Index ]
			Brush := Gdip_BrushCreateSolid( "0x66" This.SettingsData.AccentColor )
			Gdip_FillRoundedRectangle( G , Brush , cc.X * ScaleFactor , cc.Y * ScaleFactor , cc.W * ScaleFactor , cc.H * ScaleFactor , 3 * ScaleFactor )
			Gdip_DeleteBrush( Brush )
		}
		
		
		
		;~ Brush := Gdip_BrushCreateSolid( "0x66" This.SettingsData.AccentColor )
		;~ Gdip_FillRoundedRectangle( G , Brush , Ceil( ( This.ButtonPanelBackgroundX + 5 ) * ScaleFactor ) , Ceil( ( This.ButtonPanelBackgroundY + 5 ) * ScaleFactor ) , Ceil( ( This.ButtonPanelBackgroundWidth - 10 ) * ScaleFactor ) , Ceil( ( This.ButtonPanelBackgroundHeight / 2 - 10 ) * ScaleFactor ) , 3 * ScaleFactor )
		;~ Gdip_DeleteBrush( Brush )
		
		
		;~ Brush := Gdip_BrushCreateSolid( "0x66" This.SettingsData.AccentColor )
		;~ Gdip_FillRoundedRectangle( G , Brush , Ceil( ( This.ButtonPanelBackgroundX + 5 ) * ScaleFactor ) , Ceil( ( This.ButtonPanelBackgroundY + 5 + ( This.ButtonPanelBackgroundHeight / 2 ) ) * ScaleFactor ) , Ceil( ( This.ButtonPanelBackgroundWidth - 10 ) * ScaleFactor ) , Ceil( ( This.ButtonPanelBackgroundHeight / 2 - 10 ) * ScaleFactor ) , 5 * ScaleFactor )
		;~ Gdip_DeleteBrush( Brush )
		
		
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	Listbox page up button
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		x := Ceil( This.PageUpButtonX * ScaleFactor )
		y := Ceil( This.PageUpButtonY * ScaleFactor )
		w := Ceil( This.PageUpButtonWidth * ScaleFactor )
		h := Ceil( This.PageUpButtonHeight * ScaleFactor )
		;~ ToolTip, % "Tip:`n" x "`n" y "`n" w "`n" h
		Brush := Gdip_BrushCreateSolid( "0xFF000000" )
		Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 5 * ScaleFactor )
		Gdip_DeleteBrush( Brush )
		
		Pen := Gdip_CreatePen( "0x99" This.SettingsData.AccentColor , 3 )
		, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
		, Gdip_DeletePen( Pen )
		x := Ceil( ( This.PageUpButtonX + 3 ) * ScaleFactor )
		y := Ceil( ( This.PageUpButtonY + 3 ) * ScaleFactor )
		w := Ceil( ( This.PageUpButtonWidth - 6 ) * ScaleFactor )
		h := Ceil( ( This.PageUpButtonHeight - 27 ) * ScaleFactor )
		Brush := Gdip_CreateLineBrushFromRect( x , y , w , h , "0x99" This.SettingsData.AccentColor , "0xFF000000" , 1 , 1 ) 
		Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 1 * ScaleFactor )
		Gdip_DeleteBrush( Brush )
		
		if( This.Header ){
			;~ MsgBox, % This.Header
			Brush := Gdip_BrushCreateSolid( "0xFFFFFFFF" ) 
			, Gdip_TextToGraphics( G , This.Header , "s" 12 " Center vCenter Bold c" Brush " x" x + 1 " y" y + 1 , "Segoe UI" , w , h ) 
			, Gdip_DeleteBrush( Brush )
		}
		
		
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	Listbox page Down button
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		x := Ceil( This.PageDownButtonX * ScaleFactor )
		y := Ceil( This.PageDownButtonY * ScaleFactor )
		w := Ceil( This.PageDownButtonWidth * ScaleFactor )
		h := Ceil( This.PageDownButtonHeight * ScaleFactor )
		;~ ToolTip, % "Tip:`n" x "`n" y "`n" w "`n" h
		Brush := Gdip_BrushCreateSolid( "0xFF000000" )
		Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 5 * ScaleFactor )
		Gdip_DeleteBrush( Brush )
		Pen := Gdip_CreatePen( "0x99" This.SettingsData.AccentColor , 3 )
		, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
		, Gdip_DeletePen( Pen )
		x := Ceil( ( This.PageDownButtonX + 3 ) * ScaleFactor )
		y := Ceil( ( This.PageDownButtonY + 13 ) * ScaleFactor )
		w := Ceil( ( This.PageDownButtonWidth - 6 ) * ScaleFactor )
		h := Ceil( ( y + 10 - ( This.ListBoxBackgroundY + This.ListBoxBackgroundHeight ) ) * ScaleFactor )
		;~ Brush := Gdip_CreateLineBrushFromRect( x , y , w , h , "0x99" This.SettingsData.AccentColor , "0xFF000000" , 1 , 1 ) 
		Brush := Gdip_CreateLineBrushFromRect( x , y , w , h , "0x99" This.SettingsData.AccentColor , "0x99000000" , 1 , 1 ) 
		Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 1 * ScaleFactor )
		Gdip_DeleteBrush( Brush )
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	ListBox Background
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		x := Ceil( This.ListBoxBackgroundX * ScaleFactor )
		y := Ceil( This.ListBoxBackgroundY * ScaleFactor )
		w := Ceil( This.ListBoxBackgroundWidth * ScaleFactor )
		h := Ceil( This.ListBoxBackgroundHeight * ScaleFactor )
		
		;~ Brush := Gdip_BrushCreateSolid( "0xFF000000" )
		Brush := Gdip_BrushCreateSolid( "0xFF42464a" )
		Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 5 * ScaleFactor )
		Gdip_DeleteBrush( Brush )
		
		
		
		Pen := Gdip_CreatePen( "0xff" This.SettingsData.AccentColor , 3 )
		, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
		, Gdip_DeletePen( Pen )
		Brush := Gdip_CreateLineBrushFromRect( x , y , w , h / 2 , "0x66000000" , "0xFFFFFFFF" , 1 , 1 ) 
		, Pen := Gdip_CreatePenFromBrush( Brush , 1 ) 
		, Gdip_DeleteBrush( Brush ) 
		, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
		, Gdip_DeletePen( Pen )
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	ListBox Panels
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		x := Ceil( ( This.ListBoxBackgroundX + This.MarginX ) * ScaleFactor )
		y := Ceil( ( This.ListBoxBackgroundY + This.MarginY ) * ScaleFactor )
		w := Ceil( This.ListBoxPanelWidth * ScaleFactor )
		h := Ceil( This.ListBoxPanelHeight * ScaleFactor )
		cc := This.SettingsData.PanelsData
		list := This.List
		Loop, % This.SettingsData.PanelsData.MaxPanels	{
			
			;~ Brush := Gdip_BrushCreateSolid( ( tog := !tog ) ? ( ( A_Index = This.SelectedPanel || A_Index = This.HoveredPanel ) ? ( "0xFF22262a" ) : ( "0x9922262a" ) ) : ( ( A_Index = This.SelectedPanel || A_Index = This.HoveredPanel ) ? ( "0xFF32363a" ) : ( "0x9932363a" ) ) )
			Brush := Gdip_BrushCreateSolid( ( tog := !tog ) ? ( ( A_Index = This.SelectedPanel || A_Index = This.HoveredPanel ) ? ( "0xFF22262a" ) : ( "0x9922262a" ) ) : ( ( A_Index = This.SelectedPanel || A_Index = This.HoveredPanel ) ? ( "0xFF12161a" ) : ( "0x9912161a" ) ) )
			Gdip_FillRoundedRectangle( G , Brush , x , y , w , h , 5 * ScaleFactor )
			Gdip_DeleteBrush( Brush )
			
			if( A_Index = This.SelectedPanel ){
				
				Pen := Gdip_CreatePen( "0x99" This.SettingsData.AccentColor , 3 ) 
				, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
				, Gdip_DeletePen( Pen )
				
				Brush := Gdip_CreateLineBrushFromRect( x , y , w , h / 2 , "0x66000000" , "0xFFF0F0F0" , 1 , 1 ) 
				, Pen := Gdip_CreatePenFromBrush( Brush , 1 ) 
				, Gdip_DeleteBrush( Brush ) 
				, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
				, Gdip_DeletePen( Pen )
			}else if( A_Index = This.HoveredPanel ){
				
				Brush := Gdip_CreateLineBrushFromRect( x , y , w , h / 2 , "0x99000000" , "0xFF" This.SettingsData.AccentColor , 1 , 1 ) 
				, Pen := Gdip_CreatePenFromBrush( Brush , 3 ) 
				, Gdip_DeleteBrush( Brush ) 
				, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
				, Gdip_DeletePen( Pen )
			
				Brush := Gdip_CreateLineBrushFromRect( x , y , w , h / 2 , "0xFF000000" , "0xFFF0F0F0" , 1 , 1 ) 
				, Pen := Gdip_CreatePenFromBrush( Brush , 1 ) 
				, Gdip_DeleteBrush( Brush ) 
				, Gdip_DrawRoundedRectangle( G , Pen , x , y , w , h , 5 * ScaleFactor ) 
				, Gdip_DeletePen( Pen )
				
				Brush := Gdip_BrushCreateSolid( "0x66" This.SettingsData.AccentColor )
				Gdip_FillRectangle( G , Brush , x + 5 , y + h - 5 , w - 10 , 2  )
				Gdip_DeleteBrush( Brush )
		
				
				
			}
			if( This.Icons[ A_Index ] ){
				
				y := Ceil( ( This.ListBoxBackgroundY + This.MarginY ) * ScaleFactor )
				
				h := Ceil( This.ListBoxPanelHeight * ScaleFactor )
				w := Ceil( ( This.ListBoxPanelWidth - ( This.ListBoxPanelHeight - 10 ) ) * ScaleFactor )
				x := Ceil( ( This.ListBoxBackgroundX + This.MarginX + This.ListBoxPanelHeight - 2 * This.MarginX ) * ScaleFactor )
			}
			
			Brush := Gdip_BrushCreateSolid( "0xFF" This.SettingsData.PanelsData.FontColorBottom ) 
			, Gdip_TextToGraphics( G , list[ A_Index ] , "s" ( ( A_Index != This.SelectedPanel ) ? ( ceil( cc.FontSize * ScaleFactor ) ) : ( ceil( ( cc.FontSize + 2 ) * ScaleFactor ) ) ) " " cc.FontOptions " c" Brush " x" x + 1 " y" y + 1 , cc.FontType , w , h ) 
			, Gdip_DeleteBrush( Brush )
			
			Brush := Gdip_BrushCreateSolid( "0xFF" This.SettingsData.PanelsData.FontColorTop ) 
			, Gdip_TextToGraphics( G , list[ A_Index ] , "s" ( ( A_Index != This.SelectedPanel ) ? ( ceil( cc.FontSize * ScaleFactor ) ) : ( ceil( ( cc.FontSize + 2 ) * ScaleFactor ) ) ) " " cc.FontOptions " c" Brush " x" x " y" y  , cc.FontType , w , h ) 
			, Gdip_DeleteBrush( Brush )
					
			y += Ceil( This.ListBoxPanelHeight * ScaleFactor ) + This.SettingsData.PanelsData.PanelGap
		
			
		}
		
		
		
		
		
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	ARROW
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		;>>>>>>>>>>>	ARROW
		;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
		Gdip_DeleteGraphics( Graphics )
		sleep, 30
		return pBitmap
	}
	
}

scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

16 Jul 2023, 04:25

Hellbent wrote:
14 Jul 2023, 02:44
Here is a simple example of how I would go about creating a layered window with buttons that change.

The code I posted earlier could be used to sub the current hover code.

Amazing, thank you! You've given me lots to unpack and experiment with here! Much appreciated
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

17 Jul 2023, 16:47

Hellbent wrote:
14 Jul 2023, 02:44
Here is a simple example of how I would go about creating a layered window with buttons that change.

The code I posted earlier could be used to sub the current hover code.
Thank you again for this, it's incredible!

I've figured out how to use image files for my buttons, but I did have one follow-up question regarding this code if you don't mind;

Is there a way I can zero out the X, Y, W and H values? If possible, I'd like this to be determined by the image I'm using rather than the code

This is probably very suboptimal but for the sake of ease, when I create the images for overlays, I use a template that's the same size as my monitor - this way, I can use a screenshot of the fullscreen application I'm creating the overlay for and 'draw' my GUI images exactly where I want them on screen over the reference image.
Without position and size values and an image that is the size of my monitor with transparency surrounding it, the image appears exactly where I drew it in the photo editor in my GUIs.

I can't figure out a way to remove the X, Y, W and H values from this code without making the image either disappear completely or stop responding to the hover and click effects. I can see these values are referenced in the GUI controls.

If it's not possible, I can trial and error entering these values manually - but I'm eventually going to be using lots of different images that may be frequently edited and/or replaced


If you know of a quick way I can make this code just display the images 'as is' without changing it's size or position, that would be awesome

Thank you again!
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

17 Jul 2023, 20:24

I feel like I’m almost there regarding the above!

I set the X and Y values to 0 and the W and H to match my monitor resolution.
I created a test image that’s the full size of my monitor and used that. It works, but only the left half of the image is shown and the right side is completely cut off. I’m not sure what’s causing a section of my image to not be displayed
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Requesting help with using Gdip to display several images that each change on mouse over

17 Jul 2023, 23:59

I haven't gone over your post yet but this
but only the left half of the image is shown and the right side is completely cut off
Sounds like it could be due to you changing the window size without recreating the graphics stuff. (HBM,HDC,OBM,etc...)
When you up size the window you need to delete the old stuff and recreate it.

I'm not sure if that is what you have going on or not but it could be. I'll take a look at your earlier post tomorrow if you haven't resolved things by then.
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

18 Jul 2023, 04:51

Hellbent wrote:
17 Jul 2023, 23:59
I haven't gone over your post yet but this
but only the left half of the image is shown and the right side is completely cut off
Sounds like it could be due to you changing the window size without recreating the graphics stuff. (HBM,HDC,OBM,etc...)
When you up size the window you need to delete the old stuff and recreate it.

I'm not sure if that is what you have going on or not but it could be. I'll take a look at your earlier post tomorrow if you haven't resolved things by then.
I must have made a mistake somewhere because I tried the same thing on my work PC and the full image was displayed properly!

I think I may have to enter the X, Y, W and H values manually in the end. It turns out, if two images are displayed at the same time with the W and H values set to the monitor resolution, only the IconButton1 controls function.
Both images are completely transparent except for the areas where I've drawn, and these drawn areas do not overlap each other - but hovering and clicking the IconButton2 is activating IconButton1 hover/click effects instead:

Code: Select all

;****************************************************************************************************************************************************************************
#Include gdip.ahk
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Screen
Gdip_Startup()

;****************************************************************************
Example1_Default	:= Gdip_CreateBitmapFromFile("fullscreentestdefault.png")
Example1_Hover		:= Gdip_CreateBitmapFromFile("fullscreentesthover.png")
Example1_Click		:= Gdip_CreateBitmapFromFile("fullscreentestclick.png")
;****************************************************************************
Example2_Default	:= Gdip_CreateBitmapFromFile("fullscreentestdefault2.png")
Example2_Hover		:= Gdip_CreateBitmapFromFile("fullscreentesthover2.png")
Example2_Click		:= Gdip_CreateBitmapFromFile("fullscreentestclick2.png")
;****************************************************************************

Scale := 1
Gui1 := New PopUpWindow( { AutoShow: 1 , X: "Center" , Y: "Center" , W: 2560 * Scale , H: 1440 * Scale , Options: " +AlwaysOnTop -DPIScale " } ) 
Gui1.Scale := Scale


Gui1.Controls := {}

;##############
cc := Gui1.Controls.IconButton1 := { X: 0 , Y: 0 , W: 2560 , H: 1440 , Label: "IconButton1Label" }
cc.DefaultImage	:= Example1_Default
cc.HoverImage	:= Example1_Hover
cc.PressedImage	:= Example1_Click

;##############
cc := Gui1.Controls.IconButton2 := { X: 0 , Y: 0 , W: 2560 , H: 1440 , Label: "IconButton2Label" }
cc.DefaultImage	:= Example2_Default
cc.HoverImage	:= Example2_Hover
cc.PressedImage	:= Example2_Click


Gui1.HoveredControl := ""
Gui1.PressedControl := ""


OnMessage( 0x200 , Func( "MouseHover" ).Bind( Gui1 ) )
OnMessage( 0x201 , Func( "MouseClickEvent" ).Bind( Gui1 ) )

DrawWindow( Gui1 )
Attachments
Example.gif
Example.gif (1.85 MiB) Viewed 1209 times
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

18 Jul 2023, 08:04

I found an easy way of working out the exact X, Y, W and H values needed for each image and it now works perfectly! :D

Thanks a lot for your code and help!

Do you happen to have an example of how to properly use the ShowWindow and HideWindow functions? I'd like to disable AutoShow and use hotkeys to show/hide the Gui on demand.
When I use ShowWindow ( Gui1 ) in the same way DrawWindow is used, it complains that I'm making a call to a non-existent function.
ShowWindow () allows to at least run the script, but doesn't actually do anything.
Sorry, I'm sure this is fairly simple but it has me scratching my head

Code: Select all

;****************************************************************************************************************************************************************************
#Include gdip.ahk
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Screen
Gdip_Startup()

;***************************************************************
Loadout1_Default	:= Gdip_CreateBitmapFromFile("1default.png")
Loadout1_Hover		:= Gdip_CreateBitmapFromFile("1hover.png")
Loadout1_Click		:= Gdip_CreateBitmapFromFile("1click.png")
;***************************************************************
Loadout2_Default	:= Gdip_CreateBitmapFromFile("2default.png")
Loadout2_Hover		:= Gdip_CreateBitmapFromFile("2hover.png")
Loadout2_Click		:= Gdip_CreateBitmapFromFile("2click.png")
;***************************************************************

Scale := 1
Gui1 := New PopUpWindow( { AutoShow: 0 , X: "Center" , Y: "Center" , W: 2560 , H: 1440 , Options: " +AlwaysOnTop -DPIScale " } ) 
Gui1.Scale := Scale


Gui1.Controls := {}

;##############
cc := Gui1.Controls.IconButton1 := { X: 1183 , Y: 313 , W: 512 * Scale , H: 369 , Label: "IconButton1Label" }
cc.DefaultImage	:= Loadout1_Default
cc.HoverImage	:= Loadout1_Hover
cc.ClickedImage	:= Loadout1_Click

;##############
cc := Gui1.Controls.IconButton2 := { X: 1693 , Y: 235 , W: 591 * Scale , H: 398 , Label: "IconButton2Label" }
cc.DefaultImage	:= Loadout2_Default
cc.HoverImage	:= Loadout2_Hover
cc.ClickedImage	:= Loadout2_Click


Gui1.HoveredControl := ""
Gui1.ClickedControl := "" 


OnMessage( 0x200 , Func( "MouseHover" ).Bind( Gui1 ) )
OnMessage( 0x201 , Func( "MouseClickEvent" ).Bind( Gui1 ) )

DrawWindow( Gui1 )

*~$LALT::
ShowWindow( Gui1 )
KeyWait, LALT
return

LALT Up::
HideWindow(Gui1 )
return

*ESC::
ExitApp

IconButton1Label:
	SoundBeep, 555
	return

IconButton2Label:
	SoundBeep, 999
	return

MouseClickEvent( Gui1 ){
	CoordMode, Mouse, Client
	MouseGetPos, x , y , win
	if( win != Gui1.Hwnd || Gui1.Busy )
		return 
	x /= Gui1.Scale
	y /= Gui1.Scale
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
			if( cc.HasKey( "ClickedImage" ) ){
				Gui1.ClickedControl := k 
				SetTimer, WatchLeaveHover , Off
				DrawWindow( Gui1 )
				While( GetKeyState( "LButton" , "P" ) )
					Sleep, 30
				Gui1.ClickedControl := ""
				DrawWindow( Gui1 )
				SetTimer, WatchLeaveHover , On
				MouseGetPos, x , y , win
				x /= Gui1.Scale
				y /= Gui1.Scale
				if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
					SetTimer, % cc.Label , -30
				}
				return
			}else{
				gosub, % cc.Label
			}
		}
	}
}

MouseHover( Gui1 ){
	MouseGetPos, x , y , win 
	if( win != Gui1.Hwnd || Gui1.ClickedControl )
		return
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	if( !Gui1.HoveredControl ){
		for k , v in Gui1.Controls	{
			if( Gui1.LastHovered != k ){
				cc := Gui1.Controls[ k ]
				if( cc.HasKey( "DefaultImage" ) ){
					if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
						Gui1.LastHovered := Gui1.HoveredControl := k
						DrawWindow( Gui1 )
						SetTimer, WatchLeaveHover , 60 
						Sleep, 30
						return 0 
					}
				}
			}
		}
	}
	
}

WatchLeaveHover:
	if( Gui1.ClickedControl )
		return
	MouseGetPos, x , y , win 
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	cc := Gui1.Controls[ Gui1.HoveredControl ]
	if( win != Gui1.Hwnd || !( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ) ){
		SetTimer, WatchLeaveHover , Off 
		Gui1.LastHovered := Gui1.HoveredControl := ""
		DrawWindow( Gui1 )
		sleep , 30
	}
	return

DrawWindow( Gui1 ){
	if( Gui1.Busy )
		return
	Gui1.Busy := 1
	Gui1.ClearWindow()
	
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( !cc.HasKey( "DefaultImage" ) )
			continue
		if( Gui1.ClickedControl = k ){
			Gui1.DrawBitmap( cc.ClickedImage , cc , dispose := 0 , AutoUpdate := 0 )
		}else if( Gui1.HoveredControl = k ){
			Gui1.DrawBitmap( cc.HoverImage , { X: ( cc.X - 5 ) * Gui1.Scale , Y: ( cc.Y - 5 ) * Gui1.Scale , W: ( cc.W + 10 ) * Gui1.Scale , H: ( cc.H + 10 ) * Gui1.Scale } , dispose := 0 , AutoUpdate := 0 )
		}else{
			Gui1.DrawBitmap( cc.DefaultImage , cc , dispose := 0 , AutoUpdate := 0 )
		}
	}
	Gui1.UpdateWindow()
	Gui1.Busy := 0
}



;Layered Window Class
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
class PopUpWindow	{
;PopUpWindow v2.2
;Date Written: Oct 28th, 2021
;Last Edit: Feb 7th, 2022 :Changed the trigger method.
;Written By: Hellbent aka CivReborn
;SpcThanks: teadrinker , malcev 
	static Index := 0 , Windows := [] , Handles := [] , EditHwnd , HelperHwnd
	__New( obj := "" ){
		This._SetDefaults()
		This.UpdateSettings( obj )
		This._CreateWindow()
		This._CreateWindowGraphics()
		if( This.AutoShow )
			This.ShowWindow( This.Title )
	}
	_SetDefaults(){
		This.X := 10
		This.Y := 10
		This.W := 10
		This.H := 10
		This.Smoothing := 2
		This.Options := " -DPIScale +AlwaysOnTop "
		This.AutoShow := 0
		This.GdipStartUp := 0
		This.Title := ""
		
		This.Controls := []
		This.Handles := []
		This.Index := 0 
	}
	AddTrigger( obj ){
		local k , v , cc , bd
		
		This.Controls[ ++This.Index ] := { 	X:		10
										,	Y:		10
										,	W:		10
										,	H:		10	}
		for k, v in obj
			This.Controls[ This.Index ][ k ] := obj[ k ] 
		cc := This.Controls[ This.Index ]
		Gui, % This.Hwnd ":Add", Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd"
		This.Handles[ hwnd ] := This.Index
		This.Controls[ This.Index ].Hwnd := hwnd
		
		if( IsObject( cc.Label ) ){
			bd := cc.Label
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}else{
			bd := This._TriggerCall.Bind( This )
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}
		return hwnd
		
	}
	_TriggerCall(){
		MouseGetPos,,,, ctrl, 2
		Try
			;~ SetTimer, % This.Controls[ This.Handles[ ctrl ] ].Label, -0
			gosub, % This.Controls[ This.Handles[ ctrl ] ].Label
		
				
	}
	DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 0 ){
		local brush , cc 
		Brush := Gdip_BrushCreateSolid( color ) 
		Gdip_SetSmoothingMode( This.G , 3 )
		loop, % This.Controls.Length()	{
			cc := This.Controls[ A_Index ]
			Gdip_FillRectangle( This.G , Brush , cc.x , cc.y , cc.w , cc.h )
		
		}
		Gdip_DeleteBrush( Brush )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	UpdateSettings( obj := "" , UpdateGraphics := 0 ){
		local k , v
		if( IsObject( obj ) )
			for k, v in obj
				This[ k ] := obj[ k ]
		( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 ) 	
		( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 ) 	
		if( UpdateGraphics ){
			This._DestroyWindowsGraphics()
			This._CreateWindowGraphics()
		}
	}
	_CreateWindow(){
		local hwnd
		Gui , New, % " +LastFound +E0x80000 hwndhwnd -Caption  " This.Options
		PopUpWindow.Index++
		This.Index := PopUpWindow.Index
		PopUpWindow.Windows[ PopUpWindow.Index ] := This
		This.Hwnd := hwnd
		PopUpWindow.Handles[ hwnd ] := PopUpWindow.Index
		if( This.GdipStartUp && !PopUpWindow.pToken )
			PopUpWindow.pToken := GDIP_STARTUP()
	}
	_DestroyWindowsGraphics(){
		Gdip_DeleteGraphics( This.G )
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
	}
	_CreateWindowGraphics(){
		This.hbm := CreateDIBSection( This.W , This.H )
		This.hdc := CreateCompatibleDC()
		This.obm := SelectObject( This.hdc , This.hbm )
		This.G := Gdip_GraphicsFromHDC( This.hdc )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
	}
	ShowWindow( Title := "" ){
		Gui , % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
	}
	HideWindow(){
		Gui , % This.Hwnd ":Hide",
	}
	UpdateWindow( alpha := 255 ){
		UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H , alpha )
	}
	ClearWindow( AutoUpdate := 0 , Color := "" ){
		if( color != "" )
			Gdip_GraphicsClear( This.G , color )
		else
			Gdip_GraphicsClear( This.G )
		if( Autoupdate )
			This.UpdateWindow()
	}
	DrawBitmap( pBitmap , obj , dispose := 1 , AutoUpdate := 0 ){
		Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
		if( dispose )
			Gdip_DisposeImage( pBitmap )
		if( Autoupdate )
			This.UpdateWindow()
	}
	PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
		if( isObject( color ) ){
			Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) ) 
			if( color.Haskey( "Round" ) )
				Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Round )
			else
				Gdip_FillRectangle( This.G , Brush , color.X , color.Y , color.W , color.H ) 
		}else{
			Brush := Gdip_BrushCreateSolid( color ) 
			Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 ) 
		}
		Gdip_DeleteBrush( Brush )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DeleteWindow( GDIPShutdown := 0 ){
		Gui, % This.Hwnd ":Destroy"
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
		Gdip_DeleteGraphics( This.G )
		hwnd := This.Hwnd
		for k, v in PopUpWindow.Windows[ Hwnd ]
			This[k] := ""
		PopUpWindow.Windows[ Hwnd ] := ""
		if( GDIPShutdown ){
			Gdip_Shutdown( PopUpWindow.pToken )
			PopUpWindow.pToken := ""
		}
	}
	_OnClose( wParam ){
		if( wParam = 0xF060 ){	;SC_CLOSE ;[ clicking on the gui close button ]
			Try{
				Gui, % PopUpWindow.HelperHwnd ":Destroy"
				SoundBeep, 555
			}
		}
	}
	CreateCachedBitmap( pBitmap , Dispose := 0 ){
		local pCachedBitmap
		if( This.CachedBitmap )
			This.DisposeCachedbitmap()
		DllCall( "gdiplus\GdipCreateCachedBitmap" , "Ptr" , pBitmap , "Ptr" , this.G , "PtrP" , pCachedBitmap )
		This.CachedBitmap := pCachedBitmap
		if( Dispose )
			Gdip_DisposeImage( pBitmap )
	}
	DrawCachedBitmap( AutoUpdate := 0 ){
		DllCall( "gdiplus\GdipDrawCachedBitmap" , "Ptr" , this.G , "Ptr" , This.CachedBitmap , "Int" , 0 , "Int" , 0 )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DisposeCachedbitmap(){
		DllCall( "gdiplus\GdipDeleteCachedBitmap" , "Ptr" , This.CachedBitmap )
	}
	Helper(){
		local hwnd , MethodList := ["__New","UpdateSettings","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow" , "AddTrigger" , "DrawTriggers", "CreateCachedBitmap" , "DrawCachedBitmap" , "DisposeCachedbitmap" ]
		Gui, New, +AlwaysOnTop +ToolWindow +HwndHwnd
		PopUpWindow.HelperHwnd := hwnd
		Gui, Add, Edit, xm ym w250 r1 Center hwndhwnd, Gui1
		PopUpWindow.EditHwnd := hwnd
		loop, % MethodList.Length()	
			Gui, Add, Button, xm y+1 w250 r1 gPopUpWindow._HelperClip, % MethodList[ A_Index ]
		Gui, Show,,
		OnMessage( 0x112 , This._OnClose.Bind( hwnd ) )
	}
	_HelperClip(){
		local ClipList 
		
		GuiControlGet, out, % PopUpWindow.HelperHwnd ":", % PopUpWindow.EditHwnd	
		
		ClipList := 		{ 	__New: 					" := New PopUpWindow( { AutoShow: 1 , X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight , Options: "" -DPIScale +AlwaysOnTop "" } )"
							,	UpdateSettings:			".UpdateSettings( { X: """" , Y: """" , W: """" , H: """" } , UpdateGraphics := 0 )"
							,	ShowWindow:				".ShowWindow( Title := """" )"
							,	HideWindow:				".HideWindow()"
							,	UpdateWindow:			".UpdateWindow()"
							,	ClearWindow:			".ClearWindow( AutoUpdate := 0 )"
							,	DrawBitmap:				".DrawBitmap( pBitmap := """" , { X: 0 , Y: 0 , W: " Out ".W , H: " Out ".H } , dispose := 1 , AutoUpdate := 0 )"
							,	PaintBackground:		".PaintBackground( color := ""0xFF000000"" , AutoUpdate := 0 )  "  ";{ Color: ""0xFF000000"" , X: 2 , Y: 2 , W: " Out ".W - 4 , H: " Out ".H - 4 , Round: 10 }"
							,	DeleteWindow:			".DeleteWindow( GDIPShutdown := 0 )"
							,	AddTrigger:				".AddTrigger( { X: """" , Y: """" , W: """" , H: """" , Value: """" , Label: """" } )"	
							,	DrawTriggers:			".DrawTriggers( color := ""0xFFFF0000"" , AutoUpdate := 0 )"	
							,	CreateCachedBitmap:		".CreateCachedBitmap( pBitmap , Dispose := 0 )"	
							,	DrawCachedBitmap: 		".DrawCachedBitmap( AutoUpdate := 0 )"	
							,	DisposeCachedbitmap:	".DisposeCachedbitmap()"	}
							
		clipboard := Out ClipList[ A_GuiControl ]
		
	}
}
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Requesting help with using Gdip to display several images that each change on mouse over

19 Jul 2023, 00:22

scoobs525 wrote:
17 Jul 2023, 16:47
Is there a way I can zero out the X, Y, W and H values? If possible, I'd like this to be determined by the image I'm using rather than the code
You can get the width and height of your image and then use that to update or populate the values of the control objects. Gui1.Controls.MyControl := {}

Code: Select all

pBitmap := Gdip_CreateBitmapFromFile("fullscreentestdefault.png")
width := Gdip_GetImageWidth( pBitmap )
height := Gdip_GetImageHeight( pBitmap )
Both images are completely transparent except for the areas where I've drawn, and these drawn areas do not overlap each other - but hovering and clicking the IconButton2 is activating IconButton1 hover/click effects instead:
The current method of determining if a control is being hovered or not won't work without being more thoughtful about the order the controls are checked in. You can use a simple for loop and a simple array to have the controls cycled in the order needed.

Since you have a control sitting inside another control, what you need to do is check the inner control first and then check the second control.

Code: Select all

for k , v in [ "Button2" , "Button1" ]	{
	cc := Gui1.Controls[ v ]
	;...
	;...
	;...
}
	
It also looks like your larger control is intended to only be triggered when your cursor is in the border area and not triggered from the center.
If that is the case you will need to add some extra logic to test the position. A simple way to go about it is to add a new value to the control object in question ( gui1.Controls.Button1.RandomFlagName := 1 ) and look for that value when you are doing the tests ( if( statement ) ) . if the flag is found you go through the extra logic to test the extra bounds ( make sure the cursor is at the edge away from the center area )
Another way to do the above is to split out into more control objects or sub control objects. If you do split into sub controls you can use the same flag idea as in the previous method and then loop through the sub controls and test.

Do you happen to have an example of how to properly use the ShowWindow and HideWindow functions? I'd like to disable AutoShow and use hotkeys to show/hide the Gui on demand.
When I use ShowWindow ( Gui1 ) in the same way DrawWindow is used, it complains that I'm making a call to a non-existent function.
ShowWindow () allows to at least run the script, but doesn't actually do anything.
Sorry, I'm sure this is fairly simple but it has me scratching my head
You are likely familiar with code that looks similar to this.

Code: Select all


Gui , New,  +LastFound +E0x80000 +hwndhwnd -Caption -DPIScale 

hbm := CreateDIBSection( 10 , 10 )
hdc := CreateCompatibleDC()
obm := SelectObject( hdc , hbm )
G := Gdip_GraphicsFromHDC( hdc )
Gdip_SetSmoothingMode( G , 2 )

Gui, Show,

UpdateLayeredWindow( hwnd , hdc ,  x := "" ,  y := "" ,  w := "" ,  h := "" , Alpha := 255 )



The PopUpWindow class takes all of that stuff and collects it in an object.

To create a new window / window object you use this code ( with edited values ).

Code: Select all

MyWindow := New PopUpWindow( { AutoShow: 1 , X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight , Options: " -DPIScale +AlwaysOnTop " } )
Once you have created the window object you can access its values ( keys ) and functions ( methods )
The keys that it gets created with includes pretty much all the values that you can get from the code you would be familiar with.
for example

Code: Select all

MyWindow := New PopUpWindow( obj )

Msgbox, % MyWindow.X ;The x pos of the window

Msgbox, % MyWindow.Y

Msgbox, % MyWindow.W ;The width of the window

Msgbox, % MyWindow.H

Msgbox, % MyWindow.G ;pointer to the graphics ( pGraphics )

Msgbox, % MyWindow.Hwnd ;The hwnd of the window ( the window name / id )

Msgbox, % MyWindow.HDC

Msgbox, % MyWindow.HBM 

Msgbox, % Etc...

Once you have created a new window object you can start adding any new keys that you want to.
For example, if you wanted to add a pointer to a bitmap ( pBitmap ) to the window object you can do something like this.

Code: Select all

MyWindow.BackgroundImage := { X: 0 , Y: 0 , W: 100 , H: 100 , pBitmap: Gdip_CreateBitmapFromFile( "Image.png" ) }


or just simple values that you want to have associated with the window such as the color of the window or it's margin.
The sky is the limit, want to track a new value, just add it. ( after the object has been created )

Code: Select all

MyWindow.Color := "F0F0F0"
MyWindow.Margin := 10
In addition to adding values, you can also call some built in functions, you can see what functions are available and clipboard a template of the function by calling the "PopUpWindow.Helper()" method. This creates a small window with a button for each function.

Code: Select all

F1::PopUpWindow.Helper()
.
20230718235326.png
20230718235326.png (10.52 KiB) Viewed 1179 times
.

This class is intended to be a lite-weight method of simply creating a window object that can then be used in any way you want. As such, the methods that it has are kept to a minimum

Here is how to use a few of them.

If I want to clear the graphics without updating the window I use.

Code: Select all

MyWindow.ClearWindow()
If I want to clear the graphics and update the window I do either of these.

Code: Select all

MyWindow.ClearWindow( 1 ) ;AutoUpdate [1 , 0 ]

;or
;******************************************************
MyWindow.ClearWindow()

;...
;blah blah blah, drawing new stuff to the graphics
;more drawing

MyWindow.UpdateWindow() ;<<--- can use optional alpha value [ 0 , 255 ]

If you want to hide / show the window you can call the method or you can use normal gui syntax using the window objects hwnd key.

Code: Select all


MyWindow.ShowWindow()
;or
Gui, % MyWindow.Hwnd ":Show"

;******************************************************************
MyWindow.HideWindow()
;or
Gui, % MyWindow.Hwnd ":Hide"

Although this class is limited in the number of built-in functions it does have two useful functions for drawing a simple rectangle and for drawing a pBitmap.

To draw a simple rectangle that covers the entire window background you can call the PaintBackground method.

Code: Select all

Gui1.PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ) ;<<< autoupdate will automatically call the ".UpdateWindow()" method.
If you want to draw rounded rectangles or draw different sizes of rectangles you can replace the "color" parameter with an object like so.

Code: Select all

Gui1.PaintBackground( { Color: "0x99ff0000" , X: 2 , Y: 2 , W: 100 , H: 100 , Round: 10 } , AutoUpdate := 0 ) 
There is no limit to how many rectangles you draw.
If on the other hand you want to draw other shapes you can do so directly to the window or by first drawing to a separate bitmap first and then drawing the new bitmap ( shown later ).

Here is how you would fill an ellipse on the window. ( I'll also include the full steps that you normally will have to use ).

Code: Select all

MyWindow.ClearWindow()

pBrush := Gdip_BrushCreateSolid( "0xFF000000" )
Gdip_FillEllipse( MyWindow.G , pBrush , x , y , w , h ) ;Drawing on "MyWindow.G"
Gdip_DeleteBrush( pBrush )

MyWindow.UpdateWindow( 200 )
The main drawing function of the class is the DrawBitmap. With this function you can draw any bitmap on your window and have the options to dispose of the image data after it is drawn ( it still shows even if you dispose of the data ) and automatically calling the updatewindow method.

Code: Select all


;example 1

pBitmap := Gdip_CreateBitmapFromFile( "Image.png" )
MyWindow.DrawBitmap( pBitmap  , { X: 0 , Y: 0 , W: 100 , H: 100  } , dispose := 0 , AutoUpdate := 1 ) 

;example 2

MyWindow.DrawBitmap( Gdip_CreateBitmapFromFile( "Image.png" ) , { X: 0 , Y: 0 , W: 100 , H: 100  } , dispose := 1 , AutoUpdate := 1 ) 

A few years ago I created an editor to generate gdip code and I normally use the "DrawBitmap" method to draw pBitmaps from a custom function created by the editor. [can be found in the scripts and functions sub-forum ]

.
Bitmap 1.gif
Bitmap 1.gif (897.82 KiB) Viewed 1179 times
.

Once I'm done drawing what I want, I save the image and then load the custom function it creates into my clipboard ready to be pasted into a script.

Code: Select all

HB_BitmapMaker(  ScaleFactor := 1 ){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 500 * ScaleFactor , 300 * ScaleFactor ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_BrushCreateSolid( "0x22000000" ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 475 * ScaleFactor , 275 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 10 * ScaleFactor , 14 * ScaleFactor , 468 * ScaleFactor , 272 * ScaleFactor , "0x66F0F0F0" , "0x66000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 470 * ScaleFactor , 270 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 11 * ScaleFactor , 11 * ScaleFactor , 473 * ScaleFactor , 273 * ScaleFactor , "0x99F0F0F0" , "0x99000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 10 * ScaleFactor , 10 * ScaleFactor , 470 * ScaleFactor , 270 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrushFromRect( 23 * ScaleFactor , 52 * ScaleFactor , 308 * ScaleFactor , 217 * ScaleFactor , "0x9952565a" , "0x6602060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 50 * ScaleFactor , 310 * ScaleFactor , 220 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRectangle( G , Brush , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	picBitmap := Gdip_CreateBitmapFromFile( "C:\Users\CivRe\OneDrive\Desktop\AHK Tools\Color Picker Mini\Screen Shots\20210117095024.png" ) , Gdip_DrawImage( G , picBitmap , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor , 0 , 0 , 884 , 337 ) , Gdip_DisposeImage( picBitmap )
	Brush := Gdip_CreateLineBrushFromRect( 20 * ScaleFactor , 51 * ScaleFactor , 310 * ScaleFactor , 219 * ScaleFactor , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 20 * ScaleFactor , 50 * ScaleFactor , 310 * ScaleFactor , 220 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 18 * ScaleFactor , 310 * ScaleFactor , 24 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Image View / " , "s" 15 * ScaleFactor " Center vCenter  c" Brush " x" 31 * ScaleFactor " y" 7 * ScaleFactor  , "Comic Sans MS" , 110 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( G , "Image View /" , "s" 15 * ScaleFactor " Center vCenter  c" Brush " x" 30 * ScaleFactor " y" 6 * ScaleFactor  , "Comic Sans MS" , 110 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x9912161a" ) , Gdip_FillRoundedRectangle( G , Brush , 140 * ScaleFactor , 20 * ScaleFactor , 186 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( G , "File Name" , "s" 12 * ScaleFactor " Center vCenter  c" Brush " x" 140 * ScaleFactor " y" 19 * ScaleFactor  , "Comic Sans MS" , 180 * ScaleFactor , 24 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrush( 0 * ScaleFactor , 0 * ScaleFactor , 100 * ScaleFactor , 100 * ScaleFactor , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRectangle( G , Pen , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrushFromRect( 342 * ScaleFactor , 21 * ScaleFactor , 127 * ScaleFactor , 249 * ScaleFactor , "0x9952565a" , "0x9902060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 340 * ScaleFactor , 20 * ScaleFactor , 130 * ScaleFactor , 250 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 341 * ScaleFactor , 21 * ScaleFactor , 129 * ScaleFactor , 248 * ScaleFactor , "0x99F0F0F0" , "0x99000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 340 * ScaleFactor , 20 * ScaleFactor , 130 * ScaleFactor , 250 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 350 * ScaleFactor , 30 * ScaleFactor , 110 * ScaleFactor , 230 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
The above function can be used as is or it can be heavily edited with added logic ( if( Statement ) ) , etc.

If that was the code to create a custom message box, I could create it in its own window like so.

Code: Select all


MyMessageWindow := New PopUpWindow( { AutoShow: 1 , X: "Center" , Y: "Center" , W: 500 , H: 300 , Options: " +AlwaysOnTop -DPIScale " } ) 
MyMessageWindow.DrawBitmap( HB_BitmapMaker() , { X: 0 , Y: 0 , W: MyMessageWindow.W , H: MyMessageWindow.H } , dispose := 1 , AutoUpdate := 1 )

;*********************************

HB_BitmapMaker(  ScaleFactor := 1 ){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 500 * ScaleFactor , 300 * ScaleFactor ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_BrushCreateSolid( "0x22000000" ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 475 * ScaleFactor , 275 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 10 * ScaleFactor , 14 * ScaleFactor , 468 * ScaleFactor , 272 * ScaleFactor , "0x66F0F0F0" , "0x66000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 470 * ScaleFactor , 270 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 11 * ScaleFactor , 11 * ScaleFactor , 473 * ScaleFactor , 273 * ScaleFactor , "0x99F0F0F0" , "0x99000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 10 * ScaleFactor , 10 * ScaleFactor , 470 * ScaleFactor , 270 * ScaleFactor , 15 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrushFromRect( 23 * ScaleFactor , 52 * ScaleFactor , 308 * ScaleFactor , 217 * ScaleFactor , "0x9952565a" , "0x6602060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 50 * ScaleFactor , 310 * ScaleFactor , 220 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRectangle( G , Brush , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	picBitmap := Gdip_CreateBitmapFromFile( "C:\Users\CivRe\OneDrive\Desktop\AHK Tools\Color Picker Mini\Screen Shots\20210117095024.png" ) , Gdip_DrawImage( G , picBitmap , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor , 0 , 0 , 884 , 337 ) , Gdip_DisposeImage( picBitmap )
	Brush := Gdip_CreateLineBrushFromRect( 20 * ScaleFactor , 51 * ScaleFactor , 310 * ScaleFactor , 219 * ScaleFactor , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 20 * ScaleFactor , 50 * ScaleFactor , 310 * ScaleFactor , 220 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRoundedRectangle( G , Brush , 20 * ScaleFactor , 18 * ScaleFactor , 310 * ScaleFactor , 24 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Image View / " , "s" 15 * ScaleFactor " Center vCenter  c" Brush " x" 31 * ScaleFactor " y" 7 * ScaleFactor  , "Comic Sans MS" , 110 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( G , "Image View /" , "s" 15 * ScaleFactor " Center vCenter  c" Brush " x" 30 * ScaleFactor " y" 6 * ScaleFactor  , "Comic Sans MS" , 110 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x9912161a" ) , Gdip_FillRoundedRectangle( G , Brush , 140 * ScaleFactor , 20 * ScaleFactor , 186 * ScaleFactor , 20 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( G , "File Name" , "s" 12 * ScaleFactor " Center vCenter  c" Brush " x" 140 * ScaleFactor " y" 19 * ScaleFactor  , "Comic Sans MS" , 180 * ScaleFactor , 24 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrush( 0 * ScaleFactor , 0 * ScaleFactor , 100 * ScaleFactor , 100 * ScaleFactor , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRectangle( G , Pen , 30 * ScaleFactor , 60 * ScaleFactor , 290 * ScaleFactor , 200 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrushFromRect( 342 * ScaleFactor , 21 * ScaleFactor , 127 * ScaleFactor , 249 * ScaleFactor , "0x9952565a" , "0x9902060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 340 * ScaleFactor , 20 * ScaleFactor , 130 * ScaleFactor , 250 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 341 * ScaleFactor , 21 * ScaleFactor , 129 * ScaleFactor , 248 * ScaleFactor , "0x99F0F0F0" , "0x99000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 340 * ScaleFactor , 20 * ScaleFactor , 130 * ScaleFactor , 250 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF22262A" ) , Gdip_FillRectangle( G , Brush , 350 * ScaleFactor , 30 * ScaleFactor , 110 * ScaleFactor , 230 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}

If you happen to move the window you will need to update the window objects x and y keys.
That normally looks something like this.

Code: Select all

WinGetPos, x , y ,,, % "ahk_id " MyWindow.Hwnd
MyWindow.X := x
MyWindow.Y := y
if you are changing the size of the window you should use the "UpdateSettings" method and use the optional "updateGraphics" parameter to recreate the graphics stuff.

Code: Select all

MyWindow.UpdateSettings( { W: 1000 , H: 300 } , UpdateGraphics := 1  ) ; The first parameter takes an object with any keys that you want to add or change in the window object. So you can pass it nothing ( "" ) or an object ( {} ).
You can also create as many windows as you want.

Code: Select all

WindowArray := [] ;an array to hold many windows

index := 0
y := 10
Loop, 10	{
	x := 10
	Loop, 10	{
		WindowArray[ ++Index ] := New PopUpWindow( { AutoShow: 1 , X: x , Y: y , W: 50 , H: 50 , Options: " +AlwaysOnTop -DPIScale +ToolWindow " } ) 
		WindowArray[ Index ].PaintBackground( { Color: ( tog := !tog ) ? ( "0xFFFFFFFF" ) : ( "0xFF000000" ) , X: 2 , Y: 2 , W: WindowArray[ Index ].W - 4 , H: WindowArray[ Index ].H - 4  , Round: 10 } , AutoUpdate := 0 ) 
		WindowArray[ Index ].PaintBackground( { Color: "0xFFFF0000" , X: 6 , Y: 6 , W: WindowArray[ Index ].W - 12 , H: WindowArray[ Index ].H - 12  , Round: 5 } , AutoUpdate := 1 ) 
		x += 60
	}
	y += 60
}

You can delete a window once you are done with it by calling the DeleteWindow() method.

Code: Select all

MyLabel:
	MyWindow.DeleteWindow()
	MyWindow := ""
	return
I think that should be good for now, if you have any questions just ask.
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

21 Jul 2023, 11:03

Amazing, that's a lot of detail!

I have got my POC script to do almost everything I want so that I can start building on it
There is one thing I'm still struggling with;

I'm trying to update the images used for the gui live and seamlessly, based on variables set within the script

My gui is only displayed while the LALT key is held. At the moment, I have a test variable that an IF statement uses to pick a different image for one of the buttons, but the only way I've managed to update this button is by hiding, rebuilding and showing the gui again - which creates a flicker effect;

Code: Select all

*$1::
MyTestVar = 1
Gui1.HideWindow()	;Without this line, changing the variable while the GUI is open stops it from closing when LALT is no longer held and multiple instances open on top of each other
Gosub, BuildGui		;Rebuild the Gui from scratch now that the new variable has changed what images will be used with the above IF statement
Gui1.ShowWindow()	;Re-present the Gui with the new image set by the variable and IF statement
return
I was trying to use the 'Gui1.UpdateSettings( UpdateGraphics := 1 )' line to see if I could update the images live, but couldn't seem to get it to work. I also added 'AutoUpdate: 1' to the New PopUpWindow line and tried your example of updating via Gui1.ClearWindow() and Gui1.UpdateWindow()

I think I'm in way over my head!

Do you know how I can adjust the script so that I can keep holding LALT to show the gui and replace images live based on my variables? Here is the full script so far;

Code: Select all

;****************************************************************************************************************************************************************************
#Include gdip.ahk
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Screen
Gdip_Startup()

;****************************************************************************
Loadout1_Default		:= Gdip_CreateBitmapFromFile("1default.png")
Loadout1_DefaultTEST	:= Gdip_CreateBitmapFromFile("1defaultTEST.png")
Loadout1_Hover			:= Gdip_CreateBitmapFromFile("1hover.png")
Loadout1_Click			:= Gdip_CreateBitmapFromFile("1click.png")
;****************************************************************************
Loadout2_Default		:= Gdip_CreateBitmapFromFile("2default.png")
Loadout2_Hover			:= Gdip_CreateBitmapFromFile("2hover.png")
Loadout2_Click			:= Gdip_CreateBitmapFromFile("2click.png")
;****************************************************************************

BuildGui:

Scale := 1
Gui1 := New PopUpWindow( { AutoShow: 0 , AutoUpdate: 1 , X: "Center" , Y: "Center" , W: 2560 , H: 1440 , Options: " +AlwaysOnTop -DPIScale " } )
Gui1.Scale := Scale

; ******* "AutoUpdate := 1" ABOVE - CHECK WHAT THIS IS DOING*******

Gui1.Controls := {}

;##############
cc := Gui1.Controls.IconButton1 := { X: 1183 , Y: 313 , W: 512 * Scale , H: 369 , Label: "IconButton1Label" }
cc.DefaultImage	:= Loadout1_Default

if (MyTestVar = 1) {
cc.DefaultImage	:= Loadout1_DefaultTEST
}
cc.HoverImage	:= Loadout1_Hover
cc.ClickedImage	:= Loadout1_Click

;##############
cc := Gui1.Controls.IconButton2 := { X: 1693 , Y: 235 , W: 591 * Scale , H: 398 , Label: "IconButton2Label" }
cc.DefaultImage	:= Loadout2_Default
cc.HoverImage	:= Loadout2_Hover
cc.ClickedImage	:= Loadout2_Click


Gui1.HoveredControl := ""
Gui1.ClickedControl := "" 


OnMessage( 0x200 , Func( "MouseHover" ).Bind( Gui1 ) )
OnMessage( 0x201 , Func( "MouseClickEvent" ).Bind( Gui1 ) )

DrawWindow( Gui1 )
return


~*LALT::
Gui1.ShowWindow( Title := "Loadouts" )

KeyWait, LALT		;Close the Gui when LALT is no longer held
Gui1.HideWindow()
return


*$1::
MyTestVar = 1
Gui1.HideWindow()	;Without this line, changing the variable while the GUI is open stops it from closing when LALT is no longer held and multiple instances open on top of each other
Gosub, BuildGui		;Rebuild the Gui from scratch now that the new variable has changed what images will be used with the above IF statement
Gui1.ShowWindow()	;Re-present the Gui with the new image set by the variable and IF statement
return


*$2::
MyTestVar = ""
Gui1.HideWindow()	;Without this line, changing the variable while the GUI is open stops it from closing when LALT is no longer held and multiple instances open on top of each other
Gosub, BuildGui		;Rebuild the Gui from scratch now that the new variable has changed what images will be used with the above IF statement
Gui1.ShowWindow()	;Re-present the Gui with the new image set by the variable and IF statement
return


*ESC::ExitApp

;****************************************************************************

IconButton1Label:
	SoundBeep, 555
	return

IconButton2Label:
	SoundBeep, 999
	return

MouseClickEvent( Gui1 ){
	CoordMode, Mouse, Client
	MouseGetPos, x , y , win
	if( win != Gui1.Hwnd || Gui1.Busy )
		return 
	x /= Gui1.Scale
	y /= Gui1.Scale
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
			if( cc.HasKey( "ClickedImage" ) ){
				Gui1.ClickedControl := k 
				SetTimer, WatchLeaveHover , Off
				DrawWindow( Gui1 )
				While( GetKeyState( "LButton" , "P" ) )
					Sleep, 30
				Gui1.ClickedControl := ""
				DrawWindow( Gui1 )
				SetTimer, WatchLeaveHover , On
				MouseGetPos, x , y , win
				x /= Gui1.Scale
				y /= Gui1.Scale
				if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
					SetTimer, % cc.Label , -30
				}
				return
			}else{
				gosub, % cc.Label
			}
		}
	}
}

MouseHover( Gui1 ){
	MouseGetPos, x , y , win 
	if( win != Gui1.Hwnd || Gui1.ClickedControl )
		return
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	if( !Gui1.HoveredControl ){
		for k , v in Gui1.Controls	{
			if( Gui1.LastHovered != k ){
				cc := Gui1.Controls[ k ]
				if( cc.HasKey( "DefaultImage" ) ){
					if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
						Gui1.LastHovered := Gui1.HoveredControl := k
						DrawWindow( Gui1 )
						SetTimer, WatchLeaveHover , 60 
						Sleep, 30
						return 0 
					}
				}
			}
		}
	}
	
}

WatchLeaveHover:
	if( Gui1.ClickedControl )
		return
	MouseGetPos, x , y , win 
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	cc := Gui1.Controls[ Gui1.HoveredControl ]
	if( win != Gui1.Hwnd || !( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ) ){
		SetTimer, WatchLeaveHover , Off 
		Gui1.LastHovered := Gui1.HoveredControl := ""
		DrawWindow( Gui1 )
		sleep , 30
	}
	return

DrawWindow( Gui1 ){
	if( Gui1.Busy )
		return
	Gui1.Busy := 1
	Gui1.ClearWindow()
	
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( !cc.HasKey( "DefaultImage" ) )
			continue
		if( Gui1.ClickedControl = k ){
			Gui1.DrawBitmap( cc.ClickedImage , cc , dispose := 0 , AutoUpdate := 0 )
		}else if( Gui1.HoveredControl = k ){
			Gui1.DrawBitmap( cc.HoverImage , { X: ( cc.X - 5 ) * Gui1.Scale , Y: ( cc.Y - 5 ) * Gui1.Scale , W: ( cc.W + 10 ) * Gui1.Scale , H: ( cc.H + 10 ) * Gui1.Scale } , dispose := 0 , AutoUpdate := 0 )
		}else{
			Gui1.DrawBitmap( cc.DefaultImage , cc , dispose := 0 , AutoUpdate := 0 )
		}
	}
	Gui1.UpdateWindow()
	Gui1.Busy := 0
}


























;Layered Window Class
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
class PopUpWindow	{
;PopUpWindow v2.2
;Date Written: Oct 28th, 2021
;Last Edit: Feb 7th, 2022 :Changed the trigger method.
;Written By: Hellbent aka CivReborn
;SpcThanks: teadrinker , malcev 
	static Index := 0 , Windows := [] , Handles := [] , EditHwnd , HelperHwnd
	__New( obj := "" ){
		This._SetDefaults()
		This.UpdateSettings( obj )
		This._CreateWindow()
		This._CreateWindowGraphics()
		if( This.AutoShow )
			This.ShowWindow( This.Title )
	}
	_SetDefaults(){
		This.X := 10
		This.Y := 10
		This.W := 10
		This.H := 10
		This.Smoothing := 2
		This.Options := " -DPIScale +AlwaysOnTop "
		This.AutoShow := 0
		This.GdipStartUp := 0
		This.Title := ""
		
		This.Controls := []
		This.Handles := []
		This.Index := 0 
	}
	AddTrigger( obj ){
		local k , v , cc , bd
		
		This.Controls[ ++This.Index ] := { 	X:		10
										,	Y:		10
										,	W:		10
										,	H:		10	}
		for k, v in obj
			This.Controls[ This.Index ][ k ] := obj[ k ] 
		cc := This.Controls[ This.Index ]
		Gui, % This.Hwnd ":Add", Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd"
		This.Handles[ hwnd ] := This.Index
		This.Controls[ This.Index ].Hwnd := hwnd
		
		if( IsObject( cc.Label ) ){
			bd := cc.Label
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}else{
			bd := This._TriggerCall.Bind( This )
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}
		return hwnd
		
	}
	_TriggerCall(){
		MouseGetPos,,,, ctrl, 2
		Try
			;~ SetTimer, % This.Controls[ This.Handles[ ctrl ] ].Label, -0
			gosub, % This.Controls[ This.Handles[ ctrl ] ].Label
		
				
	}
	DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 0 ){
		local brush , cc 
		Brush := Gdip_BrushCreateSolid( color ) 
		Gdip_SetSmoothingMode( This.G , 3 )
		loop, % This.Controls.Length()	{
			cc := This.Controls[ A_Index ]
			Gdip_FillRectangle( This.G , Brush , cc.x , cc.y , cc.w , cc.h )
		
		}
		Gdip_DeleteBrush( Brush )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	UpdateSettings( obj := "" , UpdateGraphics := 0 ){
		local k , v
		if( IsObject( obj ) )
			for k, v in obj
				This[ k ] := obj[ k ]
		( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 ) 	
		( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 ) 	
		if( UpdateGraphics ){
			This._DestroyWindowsGraphics()
			This._CreateWindowGraphics()
		}
	}
	_CreateWindow(){
		local hwnd
		Gui , New, % " +LastFound +E0x80000 hwndhwnd -Caption  " This.Options
		PopUpWindow.Index++
		This.Index := PopUpWindow.Index
		PopUpWindow.Windows[ PopUpWindow.Index ] := This
		This.Hwnd := hwnd
		PopUpWindow.Handles[ hwnd ] := PopUpWindow.Index
		if( This.GdipStartUp && !PopUpWindow.pToken )
			PopUpWindow.pToken := GDIP_STARTUP()
	}
	_DestroyWindowsGraphics(){
		Gdip_DeleteGraphics( This.G )
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
	}
	_CreateWindowGraphics(){
		This.hbm := CreateDIBSection( This.W , This.H )
		This.hdc := CreateCompatibleDC()
		This.obm := SelectObject( This.hdc , This.hbm )
		This.G := Gdip_GraphicsFromHDC( This.hdc )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
	}
	ShowWindow( Title := "" ){
		Gui , % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
	}
	HideWindow(){
		Gui , % This.Hwnd ":Hide",
	}
	UpdateWindow( alpha := 255 ){
		UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H , alpha )
	}
	ClearWindow( AutoUpdate := 0 , Color := "" ){
		if( color != "" )
			Gdip_GraphicsClear( This.G , color )
		else
			Gdip_GraphicsClear( This.G )
		if( Autoupdate )
			This.UpdateWindow()
	}
	DrawBitmap( pBitmap , obj , dispose := 1 , AutoUpdate := 0 ){
		Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
		if( dispose )
			Gdip_DisposeImage( pBitmap )
		if( Autoupdate )
			This.UpdateWindow()
	}
	PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
		if( isObject( color ) ){
			Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) ) 
			if( color.Haskey( "Round" ) )
				Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Round )
			else
				Gdip_FillRectangle( This.G , Brush , color.X , color.Y , color.W , color.H ) 
		}else{
			Brush := Gdip_BrushCreateSolid( color ) 
			Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 ) 
		}
		Gdip_DeleteBrush( Brush )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DeleteWindow( GDIPShutdown := 0 ){
		Gui, % This.Hwnd ":Destroy"
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
		Gdip_DeleteGraphics( This.G )
		hwnd := This.Hwnd
		for k, v in PopUpWindow.Windows[ Hwnd ]
			This[k] := ""
		PopUpWindow.Windows[ Hwnd ] := ""
		if( GDIPShutdown ){
			Gdip_Shutdown( PopUpWindow.pToken )
			PopUpWindow.pToken := ""
		}
	}
	_OnClose( wParam ){
		if( wParam = 0xF060 ){	;SC_CLOSE ;[ clicking on the gui close button ]
			Try{
				Gui, % PopUpWindow.HelperHwnd ":Destroy"
				SoundBeep, 555
			}
		}
	}
	CreateCachedBitmap( pBitmap , Dispose := 0 ){
		local pCachedBitmap
		if( This.CachedBitmap )
			This.DisposeCachedbitmap()
		DllCall( "gdiplus\GdipCreateCachedBitmap" , "Ptr" , pBitmap , "Ptr" , this.G , "PtrP" , pCachedBitmap )
		This.CachedBitmap := pCachedBitmap
		if( Dispose )
			Gdip_DisposeImage( pBitmap )
	}
	DrawCachedBitmap( AutoUpdate := 0 ){
		DllCall( "gdiplus\GdipDrawCachedBitmap" , "Ptr" , this.G , "Ptr" , This.CachedBitmap , "Int" , 0 , "Int" , 0 )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DisposeCachedbitmap(){
		DllCall( "gdiplus\GdipDeleteCachedBitmap" , "Ptr" , This.CachedBitmap )
	}
	Helper(){
		local hwnd , MethodList := ["__New","UpdateSettings","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow" , "AddTrigger" , "DrawTriggers", "CreateCachedBitmap" , "DrawCachedBitmap" , "DisposeCachedbitmap" ]
		Gui, New, +AlwaysOnTop +ToolWindow +HwndHwnd
		PopUpWindow.HelperHwnd := hwnd
		Gui, Add, Edit, xm ym w250 r1 Center hwndhwnd, Gui1
		PopUpWindow.EditHwnd := hwnd
		loop, % MethodList.Length()	
			Gui, Add, Button, xm y+1 w250 r1 gPopUpWindow._HelperClip, % MethodList[ A_Index ]
		Gui, Show,,
		OnMessage( 0x112 , This._OnClose.Bind( hwnd ) )
	}
	_HelperClip(){
		local ClipList 
		
		GuiControlGet, out, % PopUpWindow.HelperHwnd ":", % PopUpWindow.EditHwnd	
		
		ClipList := 		{ 	__New: 					" := New PopUpWindow( { AutoShow: 1 , X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight , Options: "" -DPIScale +AlwaysOnTop "" } )"
							,	UpdateSettings:			".UpdateSettings( { X: """" , Y: """" , W: """" , H: """" } , UpdateGraphics := 0 )"
							,	ShowWindow:				".ShowWindow( Title := """" )"
							,	HideWindow:				".HideWindow()"
							,	UpdateWindow:			".UpdateWindow()"
							,	ClearWindow:			".ClearWindow( AutoUpdate := 0 )"
							,	DrawBitmap:				".DrawBitmap( pBitmap := """" , { X: 0 , Y: 0 , W: " Out ".W , H: " Out ".H } , dispose := 1 , AutoUpdate := 0 )"
							,	PaintBackground:		".PaintBackground( color := ""0xFF000000"" , AutoUpdate := 0 )  "  ";{ Color: ""0xFF000000"" , X: 2 , Y: 2 , W: " Out ".W - 4 , H: " Out ".H - 4 , Round: 10 }"
							,	DeleteWindow:			".DeleteWindow( GDIPShutdown := 0 )"
							,	AddTrigger:				".AddTrigger( { X: """" , Y: """" , W: """" , H: """" , Value: """" , Label: """" } )"	
							,	DrawTriggers:			".DrawTriggers( color := ""0xFFFF0000"" , AutoUpdate := 0 )"	
							,	CreateCachedBitmap:		".CreateCachedBitmap( pBitmap , Dispose := 0 )"	
							,	DrawCachedBitmap: 		".DrawCachedBitmap( AutoUpdate := 0 )"	
							,	DisposeCachedbitmap:	".DisposeCachedbitmap()"	}
							
		clipboard := Out ClipList[ A_GuiControl ]
		
	}
}
Thanks,
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Requesting help with using Gdip to display several images that each change on mouse over

22 Jul 2023, 03:07

scoobs525 wrote:
21 Jul 2023, 11:03
I'm trying to update the images used for the gui live and seamlessly, based on variables set within the script

My gui is only displayed while the LALT key is held. At the moment, I have a test variable that an IF statement uses to pick a different image for one of the buttons, but the only way I've managed to update this button is by hiding, rebuilding and showing the gui again - which creates a flicker effect;
When you want to update the window with new graphics the simplest way is to create a custom drawing function like in the example below.

Code: Select all

;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;GDIP:  https://www.autohotkey.com/boards/viewtopic.php?f=6&t=6517
#Include <PopUpWindow_V2> ;<<<-------- This was in previous posts in this thread
;****************************************************************************************************************************************************************************
#SingleInstance, Force ;run one at a time.
SetBatchLines, -1 ;run fast
Gdip_Startup() ;Start using the gdip functions.

;B64 strings for demo purposes only 
icon1_B64 := "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABbfSURBVHhe7ZsJVFRXmsefEHCLyi4gWwFFAUXtVaxFURRLsRQUFFQVCiKLIIJsIooIpiIa0USNRpNOolET09mTiUlPOpudfTWZTLozme7TrZmZTOf0zJzuSabTLt3p//xfodXGkG66z8w5HdL3nB/3vfveu+/d7373W17xhL+Vv5UZlSDSQh4jPyD4K0Z8PpGnSBeJJH9xmUd2kulu9E3iKBEn8c8q2eRDMl2H30Q+IWVkRmWATNfJbEDUhj9axJmf7sLZhGgbpi3imp9Nav91nCMJ5CtlNhi8mSJ6ii8V0V1Md+Js5ktGUVwX0500m/mSQRQDh+lOms2I9s5X/oF4D+gzs5BfUOijoLAIhUUlX8J81f50bWbLV/e/cs7V+/9X11zVJmIptkJnyLxaCL7ia3Q1tqCuoQkOdyPq3E0oKa+CXKlBhloLhVrHegpx+8r9y21X719uu7K+8rwvnzN1jyuPX33On97X+touH09XaJCVa0JTy+orBy/iK75G94pmOJwNqHOtgLux2dthcGgYQhOlWChJwcI4EkOiSSSJIGEkhASl4NolKVhMgkgICSMRJJJEkxgSR+KXJJNEkkDiSAyJJpEkgoQhPigU8cEhiA8l4WQpiWLbMtaxJJ4khiAuKQQxJJrbkawjkkIRxjqE+0HcDl+2DNEx8ZzQxisHL+IrvsaK6lrIVVqodZkUxkpo9NlYKk1DT3wC7koMx526CNxZSOxkJekhm8lOcmsEDh2JwA1khHSTJlJNzERDkkg4CT6SgJAjKpJPKslysoZsJNvJAYTceRdC9h5FyHVkkLQTJ7GSHCI/iuCYo1gaehTSsKPQEwupIc2kN+wYRs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zCXbe3tzIOOBdYR+AqwkMJX5Wxj4DPz09HoMXFRdaOHVx4RhzA2bEDSYwAJHlKQz9WCBnZ9aCgoIB6e3upv7+f+vr6HBkcHKSGhoY4G7EgHcbIQnnOjp2BgQHj5Dc7O5u1JcC81/KLExhRyhNSBK2/J4CxMDkhYbibjHCGJn2HGBDopLirb53CmqDlHcIvAGuVL78yQ9KklDr7ALa6pFZ7L0LIHPSUwJDHfPe0z+sQRgPeLgligcSb7L73eiJhbXCMHDWC3wZJZXVBCIcNGJK6F0q8woNsLmUbzgmjAuuE11+cwIlIYrT89CUVBIcglgAYJbFE/odyPigt7V9D0P4aMzt95wAAAABJRU5ErkJggg=="

;Create your layered window once.
Gui1 := New PopUpWindow( { AutoShow: 1 , X: "Center" , Y: "Center" , W: 68 , H: 68 , Options: " +AlwaysOnTop -DPIScale +ToolWindow" } ) 

;Creating some pBitmaps from the base64 strings to have something to draw for the demo.
Gui1.Icons := []
Gui1.Icons.Push( B64ToPBitmap( icon1_B64 ) )
Gui1.Icons.Push( B64ToPBitmap( icon2_B64 ) )

;setting which pBitmap is the active one.
Gui1.ActiveIcon := 1

;Create and call a custom drawing function where you do all the updates to your window from.
DrawWindow( Gui1 )


;Extra example (?)
;~ SetTimer, Demo , 1000 


return ;<--- End of Auto-Execute section 
;********************************************************
;The scripts exit routine ( How you exit the script )
GuiClose: ;Click on the close button of an unnamed gui
GuiContextMenu: ;right click on an unnamed gui
*ESC::ExitApp ;press esc or esc and any other key.
;********************************************************
RALT::PopUpWindow.Helper() ;Helper tool.
;********************************************************
Demo: ;turn on from the auto-execute section ( The "SetTimer" )
	Gui1.ActiveIcon := ( !( Gui1.ActiveIcon - 1 ) ) + 1 ;Toggling between index 1 and 2
	DrawWindow( Gui1 ) ;Call the custom draw window function.
	return
;********************************************************
F1::
	Gui1.ActiveIcon := ( !( Gui1.ActiveIcon - 1 ) ) + 1 ;Toggling between index 1 and 2
	DrawWindow( Gui1 ) ;Call the custom draw window function.
	return
;********************************************************
DrawWindow( Gui1 ){
	
	Gui1.ClearWindow() ;Clear the graphics without updating the window.
	
	;Draw the current icon on the graphics. 
	;No disposing in this case because I am going to use this pBitmap again later. 
	;I also don't need to auto update because I may want to add more things to draw ( Unlimited ).
	Gui1.DrawBitmap( Gui1.Icons[ Gui1.ActiveIcon ] , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 0 , AutoUpdate := 0 )
	
	
	;.... draw other things
	;.... draw other things
	;.... draw other things
	;.... draw other things
	;.... draw other things
	
	
	Gui1.UpdateWindow( alpha := 255 ) ;Update the window with the new graphics
	
	Sleep, 30 ;Sleeping for a short amount of time as a simple inhibitor 
	
}


;********************************************************

;Function to convert a Base 64 string into a pBitmap
B64ToPBitmap( Input ){
	local ptr , uptr , pBitmap , pStream , hData , pData , Dec , DecLen , B64
	VarSetCapacity( B64 , strlen( Input ) << !!A_IsUnicode )
	B64 := Input
	If !DllCall("Crypt32.dll\CryptStringToBinary" ( ( A_IsUnicode ) ? ( "W" ) : ( "A" ) ), Ptr := A_PtrSize ? "Ptr" : "UInt" , &B64, "UInt", 0, "UInt", 0x01, Ptr, 0, "UIntP", DecLen, Ptr, 0, Ptr, 0)
		Return False
	VarSetCapacity( Dec , DecLen , 0 )
	If !DllCall("Crypt32.dll\CryptStringToBinary" (A_IsUnicode ? "W" : "A"), Ptr, &B64, "UInt", 0, "UInt", 0x01, Ptr, &Dec, "UIntP", DecLen, Ptr, 0, Ptr, 0)
		Return False
	DllCall("Kernel32.dll\RtlMoveMemory", Ptr, pData := DllCall("Kernel32.dll\GlobalLock", Ptr, hData := DllCall( "Kernel32.dll\GlobalAlloc", "UInt", 2,  UPtr := A_PtrSize ? "UPtr" : "UInt" , DecLen, UPtr), UPtr) , Ptr, &Dec, UPtr, DecLen)
	DllCall("Kernel32.dll\GlobalUnlock", Ptr, hData)
	DllCall("Ole32.dll\CreateStreamOnHGlobal", Ptr, hData, "Int", True, Ptr "P", pStream)
	DllCall("Gdiplus.dll\GdipCreateBitmapFromStream",  Ptr, pStream, Ptr "P", pBitmap)
	return pBitmap
}




I was trying to use the 'Gui1.UpdateSettings( UpdateGraphics := 1 )' line to see if I could update the images live, but couldn't seem to get it to work.
You are missing the first parameter in Gui1.UpdateSettings( UpdateGraphics := 1 ). The first value is an object ( { X: "" , Blah: "" } ) and is optional. If you don't want to pass it an object you can leave that position blank or add ""
Like so Gui1.UpdateSettings( "" , 1 ).

Also, you only really need to call that function if you are updating / adding a lot of values or if the size of the window has changed, more specifically, if the windows size needs to get bigger.
That function doesn't have any direct link to drawing other than that updating the graphics creates a new blank graphics. ( i.e. no need to call that and "ClearWindow()" in the same breath ).

I also added 'AutoUpdate: 1' to the New PopUpWindow line and tried your example of updating via Gui1.ClearWindow() and Gui1.UpdateWindow()
The autoUpdate value is only used as a parameter in a few functions. Such as the drawing functions and the clearwindow function.
If you use the PopUpWindow.Helper() function you will get a tool that has a premade prototype call for each method ready to put in your clipboard for pasting.
Do you know how I can adjust the script so that I can keep holding LALT to show the gui and replace images live based on my variables? Here is the full script so far;
Thanks,
No problem, glad to help.

You can add this code to the demo code I posted.

Code: Select all

~$LAlt::
	While( GetKeyState( "LAlt" , "P" ) ){
		Gui1.ActiveIcon := ( !( Gui1.ActiveIcon - 1 ) ) + 1 ;Toggling between index 1 and 2
		DrawWindow( Gui1 ) ;Call the custom draw window function.
	}
	return

One last thing.
You can add / use logic in your drawing function.

Code: Select all

;********************************************************
DrawWindow( Gui1 ){
	
	Gui1.ClearWindow() ;Clear the graphics without updating the window.
	
	;Draw the current icon on the graphics. 
	;No disposing in this case because I am going to use this pBitmap again later. 
	;I also don't need to auto update because I may want to add more things to draw ( Unlimited ).
	Gui1.DrawBitmap( Gui1.Icons[ Gui1.ActiveIcon ] , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 0 , AutoUpdate := 0 )
	
	
	if( Gui1.SomeValue = "SomethingImLookingFor" )
		Gui1.DrawBitmap( Gui1.Icons[ Gui1.ActiveIcon ] , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 0 , AutoUpdate := 0 )
		
	if( up = "down"){
	
		;.... draw other things
		;.... draw other things
		
	}else if( Gui1.State = 2 ){
	
		;.... draw other things
		;.... draw other things
		
	}	
	
	;.... draw other things
	;.... draw other things
	;.... draw other things
	;.... draw other things
	;.... draw other things
	
	
	Gui1.UpdateWindow( alpha := 255 ) ;Update the window with the new graphics
	
	Sleep, 30 ;Sleeping for a short amount of time as a simple inhibitor 
	
}


;********************************************************
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

22 Jul 2023, 21:59

Again, thank you for the detailed reply

I'm sorry to keep asking follow-up questions...

Using your code, I can seamlessly update an image on a Gui now (which is great) - but now I'm struggling to figure out how to do this as well as maintaining their functionality as buttons with hover and click effects.

The images I want to update are my buttons. When my hotkey is pressed, I want to change what the image for the specific button is

This is perfect for my buttons;

Code: Select all

cc := Gui1.Controls.IconButton1 := { X: 1183 , Y: 313 , W: 512 * Scale , H: 369 , Label: "IconButton1Label" }
cc.DefaultImage	:= Loadout1_Default
cc.HoverImage	:= Loadout1_Hover
cc.ClickedImage	:= Loadout1_Click

... and this works great for live updating an image using my test '1' hotkey;

Code: Select all

Gui1.Icons := []
Gui1.Icons.Push( Loadout1_Default )
Gui1.Icons.Push( Loadout1_DefaultTEST )

Gui1.ActiveIcon := 1
DrawWindow( Gui1 )
return

1::
	Gui1.ActiveIcon := ( !( Gui1.ActiveIcon - 1 ) ) + 1 ;Toggling between index 1 and 2
	DrawWindow( Gui1 ) ;Call the custom draw window function.
	return
... but I can't figure out how to use your example custom function to update button graphics, as opposed to static graphics generated with the Gui1.Icons := [] section. This is all quote new to me and trying things I thought might work didn't go as planned :(
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Requesting help with using Gdip to display several images that each change on mouse over

23 Jul 2023, 04:35

I don't really understand what your goal is. Can you please give me more info because this seems like a very odd script.
Why are you trying to give yourself a seizure?

I have a feeling that using multiple windows is a better option but I don't know what this thing is supposed to really do besides give yourself a massive headache.

.
seizure generator.gif
seizure generator.gif (889.61 KiB) Viewed 1110 times
.

Code: Select all

;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;<<<<<<<<<<<<<<<<<<---------------------------     gdip.ahk
#Include <PopUpWindow_V2> 
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
Gdip_Startup()

BG_B64_1 := "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABbfSURBVHhe7ZsJVFRXmsefEHCLyi4gWwFFAUXtVaxFURRLsRQUFFQVCiKLIIJsIooIpiIa0USNRpNOolET09mTiUlPOpudfTWZTLozme7TrZmZTOf0zJzuSabTLt3p//xfodXGkG66z8w5HdL3nB/3vfveu+/d7373W17xhL+Vv5UZlSDSQh4jPyD4K0Z8PpGnSBeJJH9xmUd2kulu9E3iKBEn8c8q2eRDMl2H30Q+IWVkRmWATNfJbEDUhj9axJmf7sLZhGgbpi3imp9Nav91nCMJ5CtlNhi8mSJ6ii8V0V1Md+Js5ktGUVwX0500m/mSQRQDh+lOms2I9s5X/oF4D+gzs5BfUOijoLAIhUUlX8J81f50bWbLV/e/cs7V+/9X11zVJmIptkJnyLxaCL7ia3Q1tqCuoQkOdyPq3E0oKa+CXKlBhloLhVrHegpx+8r9y21X719uu7K+8rwvnzN1jyuPX33On97X+touH09XaJCVa0JTy+orBy/iK75G94pmOJwNqHOtgLux2dthcGgYQhOlWChJwcI4EkOiSSSJIGEkhASl4NolKVhMgkgICSMRJJJEkxgSR+KXJJNEkkDiSAyJJpEkgoQhPigU8cEhiA8l4WQpiWLbMtaxJJ4khiAuKQQxJJrbkawjkkIRxjqE+0HcDl+2DNEx8ZzQxisHL+IrvsaK6lrIVVqodZkUxkpo9NlYKk1DT3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Yr9pkgjM67Pw8Ol3YzQW4lGD1+DBwEF2Vgb4rp+TWQ5bRboxEYM2pfZ2qKb9C3xiWeBS7E7sAAAAAElFTkSuQmCC"
Gui1 := New PopUpWindow( { AutoShow: 1 , X: "Center" , Y: "Center" , W: 400 , H: 400 , Options: " +AlwaysOnTop -DPIScale " } ) 
Gui1.BackGround_1 := B64ToPBitmap( BG_B64_1 )
Gui1.BackGround_2 := B64ToPBitmap( BG_B64_2 )
Gui1.Controls := {}
x := 25
Loop, 9	{
	cc := Gui1.Controls[ "Button_" A_Index ] := { X: x , Y: 345 , W: 30 , H: 30 , Label: "TestLabel" }
	cc.Default := B64ToPBitmap( Button_B64_Default )
	cc.Hover := B64ToPBitmap( Button_B64_Hover )
	cc.Pressed := B64ToPBitmap( Button_B64_Pressed )
	x += 40
}
Gui1.HoveredControl := ""
Gui1.PressedControl := ""
Gui1.ActiveBackground := 1
Gui1.BackgroundArea := { X: 20 , Y: 20 , W: 360 , H: 310 }
OnMessage( 0x200 , Func( "MouseHover" ).Bind( Gui1 ) ) 
OnMessage( 0x201 , Func( "ClickEvent" ).Bind( Gui1 ) ) 
DrawBind := Func( "DrawWindow" ).Bind( Gui1 )
SetTimer, % DrawBind , 50 
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp

RALT::PopUpWindow.Helper()

TestLabel:
	ToolTip, Button Pressed
	sleep, 1000
	ToolTip
	return

LAlt::
	Gui1.TogActive := 1
	KeyWait, LAlt
	Gui1.TogActive := 0
	return

ClickEvent( Gui1 ){
	CoordMode, Mouse , Client
	MouseGetPos, x , y
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
			SetTimer, WatchLeaveHover, Off
			Gui1.PressedControl := k 
			SetTimer, WatchPressed , 30
			return
		}
	}
	
}

WatchPressed:
	if( !GetKeyState( "LButton" , "P" ) ){
		SetTimer, WatchPressed , Off
		CoordMode, Mouse , Screen
		MouseGetPos, x , y
		x -= Gui1.X 
		y -= Gui1.Y
		Gui1.HoveredControl := ""
		for k , v in Gui1.Controls	{
			cc := Gui1.Controls[ k ]
			if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
				Gui1.HoveredControl := k
				if( k = Gui1.PressedControl ){
					Gui1.PressedControl := ""
					SetTimer, WatchLeaveHover, 60
					Try{
						goSub, % cc.Label
						return
					}
				}
				Gui1.PressedControl := ""
				SetTimer, WatchLeaveHover, 60
				return
			}
		}
		Gui1.PressedControl := ""
	}
	return

MouseHover( Gui1 ){
	CoordMode, Mouse , Screen
	MouseGetPos, x , y
	x -= Gui1.X 
	y -= Gui1.Y
	if( !Gui1.HoveredControl && !Gui1.PressedControl ){
		for k , v in Gui1.Controls	{
			cc := Gui1.Controls[ k ]
			if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
				Gui1.HoveredControl := k 
				SetTimer, WatchLeaveHover, 60
				return
			}
		}
	}
}

WatchLeaveHover:
	CoordMode, Mouse, Screen
	MouseGetPos , x , y , win
	x -= Gui1.X 
	y -= Gui1.Y
	cc := Gui1.Controls[ Gui1.HoveredControl ]
	if( win != Gui1.Hwnd || !( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ) ){
		SetTimer, WatchLeaveHover, Off 
		Gui1.HoveredControl := ""
	}
	return

DrawWindow( Gui1 ){
	Critical
	Gui1.ClearWindow()
	Gui1.DrawBitmap( HB_BITMAP_MAKER( Gui1 ) , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 1 , AutoUpdate := 0 )
	if( Gui1.TogActive ){
		if( !GetKeyState( "LAlt" , "P" ) )
			Gui1.TogActive := 0
		else
			Gui1.ActiveBackground := ( !( Gui1.ActiveBackground - 1 ) ) + 1
	}
	cc := Gui1.BackgroundArea
	Gui1.DrawBitmap( Gui1[ "BackGround_" Gui1.ActiveBackground ] , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ] 
		if( k = Gui1.PressedControl ){
			Gui1.DrawBitmap( cc.Pressed , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}else if( k = Gui1.HoveredControl ){
			Gui1.DrawBitmap( cc.Hover , { X: cc.X - 2 , Y: cc.Y - 2 , W: cc.W + 4 , H: cc.H + 4 } , dispose := 0 , AutoUpdate := 0 )
		}else{
			Gui1.DrawBitmap( cc.Default , { X: cc.X , Y: cc.Y , W: cc.W , H: cc.H } , dispose := 0 , AutoUpdate := 0 )
		}
	}
	Gui1.UpdateWindow()
}

HB_BITMAP_MAKER( Gui1 ){
	pBitmap := Gdip_CreateBitmap( 400 , 400 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_BrushCreateSolid( "0x993399ff" ) , Gdip_FillRoundedRectangle( G , Brush , 10 , 10 , 380 , 380 , 15 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRoundedRectangle( G , Brush , 20 , 20 , 360 , 310 , 15 ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x99555555" ) , Gdip_FillRoundedRectangle( G , Brush , 20 , 340 , 360 , 40 , 5 ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}

B64ToPBitmap( Input ){
	local ptr , uptr , pBitmap , pStream , hData , pData , Dec , DecLen , B64
	VarSetCapacity( B64 , strlen( Input ) << !!A_IsUnicode )
	B64 := Input
	If !DllCall("Crypt32.dll\CryptStringToBinary" ( ( A_IsUnicode ) ? ( "W" ) : ( "A" ) ), Ptr := A_PtrSize ? "Ptr" : "UInt" , &B64, "UInt", 0, "UInt", 0x01, Ptr, 0, "UIntP", DecLen, Ptr, 0, Ptr, 0)
		Return False
	VarSetCapacity( Dec , DecLen , 0 )
	If !DllCall("Crypt32.dll\CryptStringToBinary" (A_IsUnicode ? "W" : "A"), Ptr, &B64, "UInt", 0, "UInt", 0x01, Ptr, &Dec, "UIntP", DecLen, Ptr, 0, Ptr, 0)
		Return False
	DllCall("Kernel32.dll\RtlMoveMemory", Ptr, pData := DllCall("Kernel32.dll\GlobalLock", Ptr, hData := DllCall( "Kernel32.dll\GlobalAlloc", "UInt", 2,  UPtr := A_PtrSize ? "UPtr" : "UInt" , DecLen, UPtr), UPtr) , Ptr, &Dec, UPtr, DecLen)
	DllCall("Kernel32.dll\GlobalUnlock", Ptr, hData)
	DllCall("Ole32.dll\CreateStreamOnHGlobal", Ptr, hData, "Int", True, Ptr "P", pStream)
	DllCall("Gdiplus.dll\GdipCreateBitmapFromStream",  Ptr, pStream, Ptr "P", pBitmap)
	return pBitmap
}

Also, would code written for windows 8 or higher work for you?
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

23 Jul 2023, 06:59

Hi,

I haven’t had a chance to play with the code in your latest post, but I wanted to clarify (there are no seizures intended :lol: )

The end goal is to press LAlt to bring up a series of buttons that are images I’ve created. Each of these buttons change appearance on hover and on click, just like your script allows.

There will be some variables in the script later that I’d like to have change the appearance of the buttons.
As an example, button 1 loads an image file, shows a different file on hover and a third image on click - but once that button has been clicked or ‘selected’, the default, hover and click images are now different to reflect it’s ‘selected’ state.

The ‘selected’ state is what I’m currently testing with the 1:: hotkey. The goal is for this to be a toggle to the alternative image, rather than a constant fast changing between them

I hope that makes more sense!
(Also yes, code for Windows 8 and higher will work for me :) )
Thanks
Last edited by scoobs525 on 23 Jul 2023, 07:52, edited 1 time in total.
jrachr
Posts: 545
Joined: 01 Mar 2021, 17:33

Re: Requesting help with using Gdip to display several images that each change on mouse over

23 Jul 2023, 07:49

@Hellbent. Good Day Hellbent. Trying to get your second example to work so I have something to learn with but keep getting error. Can you help with what I am missing. I have Windows 11 v64. Thank You.

#Include <My Altered GDIP lib>
Error, Function Library not found

Program will exit
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

23 Jul 2023, 08:30

jrachr wrote:
23 Jul 2023, 07:49
@Hellbent. Good Day Hellbent. Trying to get your second example to work so I have something to learn with but keep getting error. Can you help with what I am missing. I have Windows 11 v64. Thank You.

#Include <My Altered GDIP lib>
Error, Function Library not found

Program will exit

It’s looking for the gdip library, which you can download from here:
viewtopic.php?f=6&t=6517

You can download and place that Gdip_All.AHK file in the same location as your code file and change the line at the top of your script to say;

Code: Select all

#Include Gdip_All.ahk
jrachr
Posts: 545
Joined: 01 Mar 2021, 17:33

Re: Requesting help with using Gdip to display several images that each change on mouse over

23 Jul 2023, 09:31

@scoobs525. Thank You. I will try that out and see what happens.Cheers
scoobs525
Posts: 49
Joined: 19 Apr 2022, 16:39

Re: Requesting help with using Gdip to display several images that each change on mouse over

25 Jul 2023, 16:46

Hellbent wrote:
23 Jul 2023, 04:35
I don't really understand what your goal is. Can you please give me more info because this seems like a very odd script.

I thought a GIF would better show what I'm trying to achieve rather than just explaining

The below does everything I'm trying to accomplish, except for the fact that in order to update the GUI to show the clicked button as 'Active', I'm building the GUI again from scratch, causing a flicker

Code: Select all

;****************************************************************************************************************************************************************************
#Include gdip.ahk
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Screen
Gdip_Startup()

;****************************************************************************
Loadout1_Default		:= Gdip_CreateBitmapFromFile("1default.png")
Loadout1_Hover			:= Gdip_CreateBitmapFromFile("1hover.png")
Loadout1_Click			:= Gdip_CreateBitmapFromFile("1click.png")
Loadout1_ACTIVEDefault	:= Gdip_CreateBitmapFromFile("1ACTIVEdefault.png")
Loadout1_ACTIVEHover	:= Gdip_CreateBitmapFromFile("1ACTIVEhover.png")
Loadout1_ACTIVEClick	:= Gdip_CreateBitmapFromFile("1ACTIVEclick.png")
;****************************************************************************
Loadout2_Default		:= Gdip_CreateBitmapFromFile("2default.png")
Loadout2_Hover			:= Gdip_CreateBitmapFromFile("2hover.png")
Loadout2_Click			:= Gdip_CreateBitmapFromFile("2click.png")
Loadout2_ACTIVEDefault	:= Gdip_CreateBitmapFromFile("2ACTIVEdefault.png")
Loadout2_ACTIVEHover	:= Gdip_CreateBitmapFromFile("2ACTIVEhover.png")
Loadout2_ACTIVEClick	:= Gdip_CreateBitmapFromFile("2ACTIVEclick.png")
;****************************************************************************

BuildGui:

Scale := 1
Gui1 := New PopUpWindow( { AutoShow: 0 , AutoUpdate: 1 , X: "Center" , Y: "Center" , W: 2560 , H: 1440 , Options: " +AlwaysOnTop -DPIScale " } )
Gui1.Scale := Scale

; ******* "AutoUpdate := 1" ABOVE - CHECK WHAT THIS IS DOING*******

Gui1.Controls := {}

;##############
cc := Gui1.Controls.IconButton1 := { X: 1296 , Y: 291 , W: 340 , H: 214 , Label: "IconButton1Label" }
cc.DefaultImage	:= Loadout1_Default
cc.HoverImage	:= Loadout1_Hover
cc.ClickedImage	:= Loadout1_Click

if (Button1ACTIVE = 1) {
cc.DefaultImage	:= Loadout1_ACTIVEDefault
cc.HoverImage	:= Loadout1_ACTIVEHover
cc.ClickedImage	:= Loadout1_ACTIVEClick
}

;##############
cc := Gui1.Controls.IconButton2 := { X: 1692 , Y: 263 , W: 357 , H: 220 , Label: "IconButton2Label" }
cc.DefaultImage	:= Loadout2_Default
cc.HoverImage	:= Loadout2_Hover
cc.ClickedImage	:= Loadout2_Click

if (Button2ACTIVE = 1) {
cc.DefaultImage	:= Loadout2_ACTIVEDefault
cc.HoverImage	:= Loadout2_ACTIVEHover
cc.ClickedImage	:= Loadout2_ACTIVEClick
}


Gui1.HoveredControl := ""
Gui1.ClickedControl := "" 


OnMessage( 0x200 , Func( "MouseHover" ).Bind( Gui1 ) )
OnMessage( 0x201 , Func( "MouseClickEvent" ).Bind( Gui1 ) )

DrawWindow( Gui1 )
return


~*LALT::
Gui1.ShowWindow( Title := "Loadouts" )

KeyWait, LALT		;Close the Gui when LALT is no longer held
Gui1.HideWindow()
return


*ESC::ExitApp

;****************************************************************************

IconButton1Label:
	if (Button1ACTIVE = 1) {	;Is Button 1 already active?
	Button1ACTIVE = 0			;Turn it off if YES
	}
	else
	Button1ACTIVE = 1			;Mark Button 1 as ACTIVE
	Button2ACTIVE = 0			;Button 2 cannot be ACTIVE with Button 1
	Gui1.HideWindow()			;Without this line, changing the variable while the GUI is open stops it from closing when LALT is no longer held and multiple instances open on top of each other
	Gosub, BuildGui				;Rebuild the Gui from scratch now that the new variable has changed what images will be used with the above IF statement
	Gui1.ShowWindow()			;Re-present the Gui with the new image set by the variable and IF statement
	return

IconButton2Label:
	if (Button2ACTIVE = 1) {	;Is Button 2 already active?
	Button2ACTIVE = 0			;Turn it off if YES
	}
	else
	Button2ACTIVE = 1			;Mark Button 2 as ACTIVE
	Button1ACTIVE = 0			;Button 1 cannot be ACTIVE with Button 2
	Gui1.HideWindow()			;Without this line, changing the variable while the GUI is open stops it from closing when LALT is no longer held and multiple instances open on top of each other
	Gosub, BuildGui				;Rebuild the Gui from scratch now that the new variable has changed what images will be used with the above IF statement
	Gui1.ShowWindow()			;Re-present the Gui with the new image set by the variable and IF statement
	return

;****************************************************************************

MouseClickEvent( Gui1 ){
	CoordMode, Mouse, Client
	MouseGetPos, x , y , win
	if( win != Gui1.Hwnd || Gui1.Busy )
		return 
	x /= Gui1.Scale
	y /= Gui1.Scale
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
			if( cc.HasKey( "ClickedImage" ) ){
				Gui1.ClickedControl := k 
				SetTimer, WatchLeaveHover , Off
				DrawWindow( Gui1 )
				While( GetKeyState( "LButton" , "P" ) )
					Sleep, 30
				Gui1.ClickedControl := ""
				DrawWindow( Gui1 )
				SetTimer, WatchLeaveHover , On
				MouseGetPos, x , y , win
				x /= Gui1.Scale
				y /= Gui1.Scale
				if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
					SetTimer, % cc.Label , -30
				}
				return
			}else{
				gosub, % cc.Label
			}
		}
	}
}

MouseHover( Gui1 ){
	MouseGetPos, x , y , win 
	if( win != Gui1.Hwnd || Gui1.ClickedControl )
		return
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	if( !Gui1.HoveredControl ){
		for k , v in Gui1.Controls	{
			if( Gui1.LastHovered != k ){
				cc := Gui1.Controls[ k ]
				if( cc.HasKey( "DefaultImage" ) ){
					if( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ){
						Gui1.LastHovered := Gui1.HoveredControl := k
						DrawWindow( Gui1 )
						SetTimer, WatchLeaveHover , 60 
						Sleep, 30
						return 0 
					}
				}
			}
		}
	}
	
}

WatchLeaveHover:
	if( Gui1.ClickedControl )
		return
	MouseGetPos, x , y , win 
	x -= Gui1.X
	y -= Gui1.Y
	x /= Gui1.Scale
	y /= Gui1.Scale
	cc := Gui1.Controls[ Gui1.HoveredControl ]
	if( win != Gui1.Hwnd || !( x >= cc.X && x <= cc.X + cc.W && y >= cc.Y && y <= cc.Y + cc.H ) ){
		SetTimer, WatchLeaveHover , Off 
		Gui1.LastHovered := Gui1.HoveredControl := ""
		DrawWindow( Gui1 )
		sleep , 30
	}
	return

DrawWindow( Gui1 ){
	if( Gui1.Busy )
		return
	Gui1.Busy := 1
	Gui1.ClearWindow()
	
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		if( !cc.HasKey( "DefaultImage" ) )
			continue
		if( Gui1.ClickedControl = k ){
			Gui1.DrawBitmap( cc.ClickedImage , cc , dispose := 0 , AutoUpdate := 0 )
		}else if( Gui1.HoveredControl = k ){
			Gui1.DrawBitmap( cc.HoverImage , { X: ( cc.X - 5 ) * Gui1.Scale , Y: ( cc.Y - 5 ) * Gui1.Scale , W: ( cc.W + 10 ) * Gui1.Scale , H: ( cc.H + 10 ) * Gui1.Scale } , dispose := 0 , AutoUpdate := 0 )
		}else{
			Gui1.DrawBitmap( cc.DefaultImage , cc , dispose := 0 , AutoUpdate := 0 )
		}
	}
	Gui1.UpdateWindow()
	Gui1.Busy := 0
}


;Layered Window Class
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
class PopUpWindow	{
;PopUpWindow v2.2
;Date Written: Oct 28th, 2021
;Last Edit: Feb 7th, 2022 :Changed the trigger method.
;Written By: Hellbent aka CivReborn
;SpcThanks: teadrinker , malcev 
	static Index := 0 , Windows := [] , Handles := [] , EditHwnd , HelperHwnd
	__New( obj := "" ){
		This._SetDefaults()
		This.UpdateSettings( obj )
		This._CreateWindow()
		This._CreateWindowGraphics()
		if( This.AutoShow )
			This.ShowWindow( This.Title )
	}
	_SetDefaults(){
		This.X := 10
		This.Y := 10
		This.W := 10
		This.H := 10
		This.Smoothing := 2
		This.Options := " -DPIScale +AlwaysOnTop "
		This.AutoShow := 0
		This.GdipStartUp := 0
		This.Title := ""
		
		This.Controls := []
		This.Handles := []
		This.Index := 0 
	}
	AddTrigger( obj ){
		local k , v , cc , bd
		
		This.Controls[ ++This.Index ] := { 	X:		10
										,	Y:		10
										,	W:		10
										,	H:		10	}
		for k, v in obj
			This.Controls[ This.Index ][ k ] := obj[ k ] 
		cc := This.Controls[ This.Index ]
		Gui, % This.Hwnd ":Add", Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd"
		This.Handles[ hwnd ] := This.Index
		This.Controls[ This.Index ].Hwnd := hwnd
		
		if( IsObject( cc.Label ) ){
			bd := cc.Label
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}else{
			bd := This._TriggerCall.Bind( This )
			GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
		}
		return hwnd
		
	}
	_TriggerCall(){
		MouseGetPos,,,, ctrl, 2
		Try
			;~ SetTimer, % This.Controls[ This.Handles[ ctrl ] ].Label, -0
			gosub, % This.Controls[ This.Handles[ ctrl ] ].Label
		
				
	}
	DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 0 ){
		local brush , cc 
		Brush := Gdip_BrushCreateSolid( color ) 
		Gdip_SetSmoothingMode( This.G , 3 )
		loop, % This.Controls.Length()	{
			cc := This.Controls[ A_Index ]
			Gdip_FillRectangle( This.G , Brush , cc.x , cc.y , cc.w , cc.h )
		
		}
		Gdip_DeleteBrush( Brush )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	UpdateSettings( obj := "" , UpdateGraphics := 0 ){
		local k , v
		if( IsObject( obj ) )
			for k, v in obj
				This[ k ] := obj[ k ]
		( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 ) 	
		( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 ) 	
		if( UpdateGraphics ){
			This._DestroyWindowsGraphics()
			This._CreateWindowGraphics()
		}
	}
	_CreateWindow(){
		local hwnd
		Gui , New, % " +LastFound +E0x80000 hwndhwnd -Caption  " This.Options
		PopUpWindow.Index++
		This.Index := PopUpWindow.Index
		PopUpWindow.Windows[ PopUpWindow.Index ] := This
		This.Hwnd := hwnd
		PopUpWindow.Handles[ hwnd ] := PopUpWindow.Index
		if( This.GdipStartUp && !PopUpWindow.pToken )
			PopUpWindow.pToken := GDIP_STARTUP()
	}
	_DestroyWindowsGraphics(){
		Gdip_DeleteGraphics( This.G )
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
	}
	_CreateWindowGraphics(){
		This.hbm := CreateDIBSection( This.W , This.H )
		This.hdc := CreateCompatibleDC()
		This.obm := SelectObject( This.hdc , This.hbm )
		This.G := Gdip_GraphicsFromHDC( This.hdc )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
	}
	ShowWindow( Title := "" ){
		Gui , % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
	}
	HideWindow(){
		Gui , % This.Hwnd ":Hide",
	}
	UpdateWindow( alpha := 255 ){
		UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H , alpha )
	}
	ClearWindow( AutoUpdate := 0 , Color := "" ){
		if( color != "" )
			Gdip_GraphicsClear( This.G , color )
		else
			Gdip_GraphicsClear( This.G )
		if( Autoupdate )
			This.UpdateWindow()
	}
	DrawBitmap( pBitmap , obj , dispose := 1 , AutoUpdate := 0 ){
		Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
		if( dispose )
			Gdip_DisposeImage( pBitmap )
		if( Autoupdate )
			This.UpdateWindow()
	}
	PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
		if( isObject( color ) ){
			Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) ) 
			if( color.Haskey( "Round" ) )
				Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Round )
			else
				Gdip_FillRectangle( This.G , Brush , color.X , color.Y , color.W , color.H ) 
		}else{
			Brush := Gdip_BrushCreateSolid( color ) 
			Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 ) 
		}
		Gdip_DeleteBrush( Brush )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DeleteWindow( GDIPShutdown := 0 ){
		Gui, % This.Hwnd ":Destroy"
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
		Gdip_DeleteGraphics( This.G )
		hwnd := This.Hwnd
		for k, v in PopUpWindow.Windows[ Hwnd ]
			This[k] := ""
		PopUpWindow.Windows[ Hwnd ] := ""
		if( GDIPShutdown ){
			Gdip_Shutdown( PopUpWindow.pToken )
			PopUpWindow.pToken := ""
		}
	}
	_OnClose( wParam ){
		if( wParam = 0xF060 ){	;SC_CLOSE ;[ clicking on the gui close button ]
			Try{
				Gui, % PopUpWindow.HelperHwnd ":Destroy"
				SoundBeep, 555
			}
		}
	}
	CreateCachedBitmap( pBitmap , Dispose := 0 ){
		local pCachedBitmap
		if( This.CachedBitmap )
			This.DisposeCachedbitmap()
		DllCall( "gdiplus\GdipCreateCachedBitmap" , "Ptr" , pBitmap , "Ptr" , this.G , "PtrP" , pCachedBitmap )
		This.CachedBitmap := pCachedBitmap
		if( Dispose )
			Gdip_DisposeImage( pBitmap )
	}
	DrawCachedBitmap( AutoUpdate := 0 ){
		DllCall( "gdiplus\GdipDrawCachedBitmap" , "Ptr" , this.G , "Ptr" , This.CachedBitmap , "Int" , 0 , "Int" , 0 )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DisposeCachedbitmap(){
		DllCall( "gdiplus\GdipDeleteCachedBitmap" , "Ptr" , This.CachedBitmap )
	}
	Helper(){
		local hwnd , MethodList := ["__New","UpdateSettings","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow" , "AddTrigger" , "DrawTriggers", "CreateCachedBitmap" , "DrawCachedBitmap" , "DisposeCachedbitmap" ]
		Gui, New, +AlwaysOnTop +ToolWindow +HwndHwnd
		PopUpWindow.HelperHwnd := hwnd
		Gui, Add, Edit, xm ym w250 r1 Center hwndhwnd, Gui1
		PopUpWindow.EditHwnd := hwnd
		loop, % MethodList.Length()	
			Gui, Add, Button, xm y+1 w250 r1 gPopUpWindow._HelperClip, % MethodList[ A_Index ]
		Gui, Show,,
		OnMessage( 0x112 , This._OnClose.Bind( hwnd ) )
	}
	_HelperClip(){
		local ClipList 
		
		GuiControlGet, out, % PopUpWindow.HelperHwnd ":", % PopUpWindow.EditHwnd	
		
		ClipList := 		{ 	__New: 					" := New PopUpWindow( { AutoShow: 1 , X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight , Options: "" -DPIScale +AlwaysOnTop "" } )"
							,	UpdateSettings:			".UpdateSettings( { X: """" , Y: """" , W: """" , H: """" } , UpdateGraphics := 0 )"
							,	ShowWindow:				".ShowWindow( Title := """" )"
							,	HideWindow:				".HideWindow()"
							,	UpdateWindow:			".UpdateWindow()"
							,	ClearWindow:			".ClearWindow( AutoUpdate := 0 )"
							,	DrawBitmap:				".DrawBitmap( pBitmap := """" , { X: 0 , Y: 0 , W: " Out ".W , H: " Out ".H } , dispose := 1 , AutoUpdate := 0 )"
							,	PaintBackground:		".PaintBackground( color := ""0xFF000000"" , AutoUpdate := 0 )  "  ";{ Color: ""0xFF000000"" , X: 2 , Y: 2 , W: " Out ".W - 4 , H: " Out ".H - 4 , Round: 10 }"
							,	DeleteWindow:			".DeleteWindow( GDIPShutdown := 0 )"
							,	AddTrigger:				".AddTrigger( { X: """" , Y: """" , W: """" , H: """" , Value: """" , Label: """" } )"	
							,	DrawTriggers:			".DrawTriggers( color := ""0xFFFF0000"" , AutoUpdate := 0 )"	
							,	CreateCachedBitmap:		".CreateCachedBitmap( pBitmap , Dispose := 0 )"	
							,	DrawCachedBitmap: 		".DrawCachedBitmap( AutoUpdate := 0 )"	
							,	DisposeCachedbitmap:	".DisposeCachedbitmap()"	}
							
		clipboard := Out ClipList[ A_GuiControl ]
		
	}
}
Attachments
GUIDemo.gif
GUIDemo.gif (1.49 MiB) Viewed 1045 times
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Requesting help with using Gdip to display several images that each change on mouse over

26 Jul 2023, 22:34

It looks like you are trying to create a custom radio control set.

Have a look at this.
This is written for windows 8+ and uses invisible text controls as a method of simplifying things.
Using this method you can directly call your buttons function / label and you can sort of ping the window to get a direct link to your control objects.

PRESS AND HOLD LALT to show the buttons.

.
switch 1.gif
switch 1.gif (160.31 KiB) Viewed 1000 times
.


Code: Select all

;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;GDIP:  https://www.autohotkey.com/boards/viewtopic.php?f=6&t=6517
#Include <PopUpWindow_V2> 
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
Gdip_Startup()

Gui1 := New PopUpWindow( { AutoShow: 0 , X: A_ScreenWidth - 350 , Y: "Center" , W: 300 , H: 150 , Options: " +AlwaysOnTop -DPIScale +ToolWindow " } ) 

AddControls( Gui1 )

Gui1.PressedControl := ""
Gui1.HoveredControl := ""
Gui1.SelectedControl := ""

DrawWindow( Gui1 )

OnMessage( 0x200 , Func( "MouseHover" ).Bind( Gui1 ) )

return
GuiClose:
GuiContextMenu:
*ESC::ExitApp

;~ RALT::PopUpWindow.Helper()

LAlt:: ;Press Left Alt to show the window
	Gui1.ShowWindow()
	KeyWait, LAlt
	Gui1.HideWindow()
	return


;###################################################################
ToggleState( Gui1 , hwnd ){
	SetTimer, WatchLeaveHover , Off
	sleep, 60
	Gui1.Busy := 1
	cc := Gui1.Handles[ hwnd ]
	Gui1.PressedControl := cc.Name
	DrawWindow( Gui1 )
	While( GetKeyState( "LButton" , "P" ) )
		Sleep, 30
	MouseGetPos,,,, ctrl , 2 
	Gui1.PressedControl := ""
	if( ctrl = hwnd ){
		if( cc.Name = Gui1.SelectedControl ){
		
			Gui1.SelectedControl := ""
			Gui1.HoveredControl := cc.Name
			
		}else{
			Gui1.SelectedControl := cc.Name
			Gui1.HoveredControl := cc.Name
			
		}
	}else{
		Gui1.HoveredControl := ""
	}
	DrawWindow( Gui1 )
	Gui1.Busy := 0
	SetTimer, WatchLeaveHover , 60
}
;###################################################################
MouseHover( Gui1 ){
	MouseGetPos,,,, ctrl , 2
	
	if( !Gui1.Busy && !Gui1.HoveredControl && !Gui1.PressedControl && isObject( cc := Gui1.Handles[ ctrl ] ) ){
		Gui1.HoveredControl := cc.Name
		DrawWindow( Gui1 )
		SetTimer, WatchLeaveHover , 60
	}
	
	
}

;###################################################################
WatchLeaveHover:
	MouseGetPos,,,, ctrl , 2
	if( !Gui1.Busy && !Gui1.PressedControl && Gui1.Handles[ ctrl ].Name != Gui1.HoveredControl ){
		Gui1.Busy := 1
		SetTimer, WatchLeaveHover , Off
		Gui1.HoveredControl := ""
		DrawWindow( Gui1 )
		Gui1.Busy := 0
	}
	return
;###################################################################

AddControls( Gui1 ){
	
	Gui1.Controls := {}
	Gui1.Handles := []
	
	Gui1.Controls.Button_1 := { X: 10 , Y: 10 , W: 100 , H: 100 , State: 0 , Function: "ToggleState" , Colors: [ "0xFF00FF00" , "0xFF80FF80" , "0xFF008080" , "0xFFFFFF00" , "0xFFFFFF80" , "0xFFFF8040" ] , Text: [ "Default" , "Hovered" , "Pressed" , "Selected Default" , "Selected Hovered" , "Selected Pressed" ] }
	Gui1.Controls.Button_2 := { X: 120 , Y: 10 , W: 100 , H: 100 , State: 0 , Function: "ToggleState" , Colors: [ "0xFF00FF80" , "0xFF80FFFF" , "0xFF008080" , "0xFFFF80C0" , "0xFFFF80FF" , "0xFFFF0000" ] , Text: [ "Default" , "Hovered" , "Pressed" , "Selected Default" , "Selected Hovered" , "Selected Pressed" ] }
	
	for k , v in Gui1.Controls	{
		cc := Gui1.Controls[ k ]
		Gui, % Gui1.Hwnd ":Add" , Text , % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd"
		cc.Hwnd := hwnd
		cc.Name := k
		Gui1.Handles[ hwnd ] := cc 
		bd := Func( cc.Function ).Bind( Gui1 , hwnd )
		GuiControl, % Gui1.Hwnd ":+G", % hwnd , % bd
	}
	
}

DrawWindow( Gui1 ){
	
	Gui1.ClearWindow()
	
	for k , v in Gui1.Controls	{
		
		cc := Gui1.Controls[ k ]
		
		if( k = Gui1.SelectedControl ){
		
			if( k = Gui1.PressedControl ){
				;Replace these two lines with your button ( same for below ).
				Gui1.PaintBackground( { Color: "0x99" SubStr( cc.Colors[ 6 ] , 5 ) , X: cc.X , Y: cc.Y , W: cc.W , H: cc.H , Round: 10 } ) 
				Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( Gui1.G , cc.Name " " cc.Text[ 6 ] , "s" 16 " Center vCenter Bold c" Brush " x" cc.x " y" cc.y  , "Segoe UI" , cc.w , cc.h ) , Gdip_DeleteBrush( Brush )	
	
			}else if( k = Gui1.HoveredControl ){
				Gui1.PaintBackground( { Color: "0x99" SubStr( cc.Colors[ 5 ] , 5 ) , X: cc.X , Y: cc.Y , W: cc.W , H: cc.H , Round: 10 } ) 
				Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( Gui1.G , cc.Name " " cc.Text[ 5 ] , "s" 16 " Center vCenter Bold c" Brush " x" cc.x " y" cc.y  , "Segoe UI" , cc.w , cc.h ) , Gdip_DeleteBrush( Brush )	
	
			}else{
				Gui1.PaintBackground( { Color: "0x99" SubStr( cc.Colors[ 4 ] , 5 ) , X: cc.X , Y: cc.Y , W: cc.W , H: cc.H , Round: 10 } ) 
				Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( Gui1.G , cc.Name " " cc.Text[ 4 ] , "s" 16 " Center vCenter Bold c" Brush " x" cc.x " y" cc.y  , "Segoe UI" , cc.w , cc.h ) , Gdip_DeleteBrush( Brush )	
	
			}
		}else{
			if( k = Gui1.PressedControl ){
				Gui1.PaintBackground( { Color: "0x99" SubStr( cc.Colors[ 3 ] , 5 ) , X: cc.X , Y: cc.Y , W: cc.W , H: cc.H , Round: 10 } ) 
				Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( Gui1.G , cc.Name " " cc.Text[ 3 ] , "s" 16 " Center vCenter Bold c" Brush " x" cc.x " y" cc.y  , "Segoe UI" , cc.w , cc.h ) , Gdip_DeleteBrush( Brush )	
	
			}else if( k = Gui1.HoveredControl ){
				Gui1.PaintBackground( { Color: "0x99" SubStr( cc.Colors[ 2 ] , 5 ) , X: cc.X , Y: cc.Y , W: cc.W , H: cc.H , Round: 10 } ) 
				Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( Gui1.G , cc.Name " " cc.Text[ 2 ] , "s" 16 " Center vCenter Bold c" Brush " x" cc.x " y" cc.y  , "Segoe UI" , cc.w , cc.h ) , Gdip_DeleteBrush( Brush )	
	
			}else{
				Gui1.PaintBackground( { Color: "0x99" SubStr( cc.Colors[ 1 ] , 5 ) , X: cc.X , Y: cc.Y , W: cc.W , H: cc.H , Round: 10 } ) 
				Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( Gui1.G , cc.Name " " cc.Text[ 1 ] , "s" 16 " Center vCenter Bold c" Brush " x" cc.x " y" cc.y  , "Segoe UI" , cc.w , cc.h ) , Gdip_DeleteBrush( Brush )	
	
			}
		}
		
	}
	
	Gui1.UpdateWindow()
	
}
Let me know if you have any questions.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 362 guests