I have done a pass at the graphics for the dial control in my Bitmap Maker script
.
I'm not sure if I will code them in or not, but here are the graphics for them ( 3 color themes )
It should be easy enough to adapt the class to use these graphics, with the exception of the small circle (If you can't figure out how to code it you can remove it)
Code: Select all
;***************************************************************************************************
#Include <My Altered Gdip Lib> ;Replace with your path to the Gdip.ahk lib
;***************************************************************************************************
;#Include <PopUpWindow Class> ;I have included this class at the bottom of the script
;***************************************************************************************************
#SingleInstance force
#NoEnv
SetBatchLines, -1
GDIP_StartUp()
Gui1 := New PopUpWindow( { WindowName: "1" , WindowOptions: " -DPIScale +AlwaysOnTop " , WindowSmoothing: 2 , X: A_ScreenWidth / 2 - ( w := 5 * 90 ) / 2 , Y: 100 , W: w + 20, H: 166 } )
Gui1.ShowWindow( "Dial Design 2" )
Gui1.PaintBackground( "0xFF22262a" )
Gui1.DrawBitmap( BlueDial() , { X: x := 90 , Y: 20 , W: w := 90 , H: h := 126 } , dispose := 1 )
Gui1.DrawBitmap( GreenDial() , { X: x += w + 10 , Y: 20 , W: w , H: h } , dispose := 1 )
Gui1.DrawBitmap( RedDial() , { X: x += w + 10 , Y: 20 , W: w , H: h } , dispose := 1 )
Gui1.UpdateWindow()
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
Numpad3::
PopUpWindow.Helper()
return
BlueDial(){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 90 , 126 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRectangle( G , Brush , -2 , -2 , 94 , 134 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 25 , 45 , 55 , 74 , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Gdip_FillEllipse( G , Brush , 21 , 41 , 48 , 48 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 17 , 44 , 52 , 40 , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 22 , 42 , 46 , 46 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 28 , 46 , 35 , 30 , "0xFF333333" , "0xFF000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 26 , 46 , 38 , 38 ) , Gdip_DeleteBrush( Brush )
Pen := Gdip_CreatePen( "0xFF000000" , 3 ) , Gdip_DrawArc( G , Pen , 30 , 50 , 30 , 30 , 180 , 270 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFF3399FF" , 2 ) , Gdip_DrawArc( G , Pen , 30 , 50 , 30 , 30 , 180 , 135 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 35 , 58 , 19 , 17 , "0xFF000000" , "0x663399FF" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 37 , 58 , 16 , 16 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 37 , 60 , 17 , 10 , "0xFF3399FF" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 37 , 58 , 16 , 16 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 33 , 48 , 24 , 20 , "0x44999999" , "0x00000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 33 , 52 , 22 , 10 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF3399FF" ) , Gdip_FillEllipse( G , Brush , 62 , 40 , 5 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 23 , 97 , 47 , 15 , "0xFF333333" , "0xFF000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 20 , 95 , 50 , 20 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 12 , 95 , 25 , 75 , "0xFF3399FF" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 20 , 95 , 50 , 20 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x20 y95" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x22 y97" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF3399FF" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x21 y96" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 10 , 8 , 71 , 18 , "0x553399FF" , "0xFF000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 10 , 5 , 70 , 20 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 9 , 5 , 71 , 39 , "0x99000000" , "0xaaF0F0F0" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 10 , 5 , 70 , 20 , 5 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0x11F0F0F0" , 5 ) , Gdip_DrawLine( G , Pen , 14 , 10 , 76 , 9 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x9 y5" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x11 y7" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFa2c6ff" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x10 y6" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 3 , 3 , 84 , 64 , "0xFF3399FF" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 2 , 2 , 85 , 120 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrush( 0 , 115 , 88 , 66 , "0xFF3399FF" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 2 , 2 , 85 , 120 , 5 ) , Gdip_DeletePen( Pen )
Gdip_DeleteGraphics( G )
return pBitmap
}
GreenDial(){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 90 , 126 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRectangle( G , Brush , -2 , -2 , 94 , 134 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 25 , 45 , 55 , 74 , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Gdip_FillEllipse( G , Brush , 21 , 41 , 48 , 48 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 17 , 44 , 52 , 40 , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 22 , 42 , 46 , 46 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 28 , 46 , 35 , 30 , "0xFF333333" , "0xFF000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 26 , 46 , 38 , 38 ) , Gdip_DeleteBrush( Brush )
Pen := Gdip_CreatePen( "0xFF000000" , 3 ) , Gdip_DrawArc( G , Pen , 30 , 50 , 30 , 30 , 180 , 270 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFF00ff00" , 2 ) , Gdip_DrawArc( G , Pen , 30 , 50 , 30 , 30 , 180 , 135 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 35 , 58 , 19 , 17 , "0xFF000000" , "0x6600ff00" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 37 , 58 , 16 , 16 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 37 , 60 , 17 , 10 , "0xFF00ff00" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 37 , 58 , 16 , 16 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 33 , 48 , 24 , 20 , "0x44999999" , "0x00000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 33 , 52 , 22 , 10 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillEllipse( G , Brush , 62 , 40 , 5 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 23 , 97 , 47 , 15 , "0xFF333333" , "0xFF000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 20 , 95 , 50 , 20 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 12 , 95 , 25 , 75 , "0xFF00ff00" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 20 , 95 , 50 , 20 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x20 y95" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x22 y97" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x21 y96" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 10 , 8 , 71 , 18 , "0x5500ff00" , "0xFF000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 10 , 5 , 70 , 20 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 9 , 5 , 71 , 39 , "0x99000000" , "0xaaF0F0F0" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 10 , 5 , 70 , 20 , 5 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0x11F0F0F0" , 5 ) , Gdip_DrawLine( G , Pen , 14 , 10 , 76 , 9 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x9 y5" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x11 y7" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFa2ffa2" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x10 y6" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 3 , 3 , 84 , 64 , "0xFF00ff00" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 2 , 2 , 85 , 120 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrush( 0 , 115 , 88 , 66 , "0xFF00ff00" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 2 , 2 , 85 , 120 , 5 ) , Gdip_DeletePen( Pen )
Gdip_DeleteGraphics( G )
return pBitmap
}
RedDial(){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 90 , 126 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF22262a" ) , Gdip_FillRectangle( G , Brush , -2 , -2 , 94 , 134 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 25 , 45 , 55 , 74 , "0xFFF0F0F0" , "0xFF000000" , 1 ) , Gdip_FillEllipse( G , Brush , 21 , 41 , 48 , 48 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 17 , 44 , 52 , 40 , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 22 , 42 , 46 , 46 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 28 , 46 , 35 , 30 , "0xFF333333" , "0xFF000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 26 , 46 , 38 , 38 ) , Gdip_DeleteBrush( Brush )
Pen := Gdip_CreatePen( "0xFF000000" , 3 ) , Gdip_DrawArc( G , Pen , 30 , 50 , 30 , 30 , 180 , 270 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFFff0000" , 2 ) , Gdip_DrawArc( G , Pen , 30 , 50 , 30 , 30 , 180 , 135 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 35 , 58 , 19 , 17 , "0xFF000000" , "0x66ff0000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 37 , 58 , 16 , 16 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 37 , 60 , 17 , 10 , "0xFFff0000" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 37 , 58 , 16 , 16 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 33 , 48 , 24 , 20 , "0x44999999" , "0x00000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 33 , 52 , 22 , 10 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_FillEllipse( G , Brush , 62 , 40 , 5 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 23 , 97 , 47 , 15 , "0xFF333333" , "0xFF000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 20 , 95 , 50 , 20 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 12 , 95 , 25 , 75 , "0xFFff0000" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 20 , 95 , 50 , 20 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x20 y95" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x22 y97" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_TextToGraphics( G , "12345" , "s14 Center vCenter bold c" Brush " x21 y96" , "Segoe ui" , 50 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 10 , 8 , 71 , 18 , "0x55ff0000" , "0xFF000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 10 , 5 , 70 , 20 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 9 , 5 , 71 , 39 , "0x99000000" , "0xaaF0F0F0" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 10 , 5 , 70 , 20 , 5 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0x11F0F0F0" , 5 ) , Gdip_DrawLine( G , Pen , 14 , 10 , 76 , 9 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x9 y5" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x11 y7" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFffc6a2" ) , Gdip_TextToGraphics( G , "Master" , "s12 Center vCenter Bold c" Brush " x10 y6" , "Segoe ui" , 70 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 3 , 3 , 84 , 64 , "0xFFff0000" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 2 , 2 , 85 , 120 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrush( 0 , 115 , 88 , 66 , "0xFFff0000" , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 2 , 2 , 85 , 120 , 5 ) , Gdip_DeletePen( Pen )
Gdip_DeleteGraphics( G )
return pBitmap
}
;************************************************************************************************************************************************************************************************
;************************************************************************************************************************************************************************************************
;************************************************************************************************************************************************************************************************
;Layered Window Class
class PopUpWindow {
;Class By: Hellbent
;Apr 2021
static Index := 0 , Windows := [] , Handles := [] , HelpHandles := [] , HelperEditHwnd
__New( obj := "" ){
This._SetDefaults( )
if( isObject( obj ) )
This.SetWindowProperties( obj )
This._SetupWindowGraphics()
}
_SetDefaults(){
PopUpWindow.Index++
This.WindowName := "HBLayeredWindow" PopUpWindow.Index
This.WindowSmoothing := 2
This.WindowOptions := " -DPIScale +AlwaysOnTop "
This.X := 10
This.Y := 10
This.W := 10
This.H := 10
}
PaintBackground( color := "0xFF000000" ){
Brush := Gdip_BrushCreateSolid( color )
Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 )
Gdip_DeleteBrush( Brush )
}
_SetupWindowGraphics(){
This.Hwnd := This._CreateGUI()
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.WindowSmoothing )
PopUpWindow.Handles[ This.Hwnd ] := PopUpWindow.Index
PopUpWindow.Windows[ PopUpWindow.Index ] := This
}
SetWindowProperties( obj , updateG := 0 ){
local k , v
for k , v in obj
if( k != "hwnd" )
This[k] := v
if(updateG){
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
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.WindowSmoothing )
}
}
ShowWindow( Title := "" ){
Gui , % This.WindowName ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
}
HideWindow(){
Gui , % This.WindowName ":Hide",
}
UpdateWindow(){
UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H )
;~ UpdateLayeredWindow( This.hwnd , This.hdc )
}
ClearWindow(){
Gdip_GraphicsClear( This.G )
}
DrawBitmap( pBitmap , obj := "" , dispose := 1 ){
(!IsObject(obj))?(obj := {})
(!obj.HasKey("X"))?(obj.X:=0)
(!obj.HasKey("Y"))?(obj.Y:=0)
(!obj.HasKey("W"))?(obj.W:=This.W)
(!obj.HasKey("H"))?(obj.H:=This.H)
Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
if( dispose )
Gdip_DisposeImage( pBitmap )
}
DeleteWindow(){
Gui, % This.WindowName ":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 ] := ""
}
_CreateGUI(){
local hwnd
Gui , % This.WindowName ":New" , % " +E0x80000 hwndhwnd -Caption " This.WindowOptions
return hwnd
}
Helper(){
local List := ["New Window","SetWindowProperties","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow"]
local hwnd, bd
Gui, HBLWHelperGui:New, +AlwaysOnTop
Gui, HBLWHelperGui:Color, 62666a, 24282c
Gui, HBLWHelperGui:Font, cWhite s10 , Segoe UI
Gui, HBLWHelperGui:Margin, 5 , 5
Gui, HBLWHelperGui:Add, Edit, xm ym w200 r1 Center hwndHwnd, Gui1
PopUpWindow.HelperEditHwnd := Hwnd
Gui, HBLWHelperGui:Margin, 5 , 1
Loop, % List.Length() {
Gui, HBLWHelperGui:Add, Button, xm wp h23 -Theme hwndhwnd, % List[ A_Index ]
PopUpWindow.HelpHandles[hwnd] := List[ A_Index ]
bd := PopUpWindow._ClipIt.Bind( PopUpWindow )
GuiControl , HBLWHelperGui: +G , % Hwnd , % bd
}
Gui, HBLWHelperGui:Show,
}
_ClipIt(){
local List := ["New Window","SetWindowProperties","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow"]
local Output , FQ := 400
GuiControlGet, Output , HBLWHelperGui: , % PopUpWindow.HelperEditHwnd
Switch A_GuiControl
{
case List[1]:
Clipboard := Output " := New PopUpWindow( { WindowName: ""1"" , WindowOptions: "" -DPIScale +AlwaysOnTop "" , WindowSmoothing: 2 , X: ""Center"" , Y: ""Center"" , W: 100 , H: 100 } )"
loop 2
SoundBeep, FQ
return
case List[2]:
Clipboard := Output ".SetWindowProperties( { X: """" , Y: """" , W: """" , H: """" } )"
loop 2
SoundBeep, FQ
return
case List[3]:
Clipboard := Output ".ShowWindow( MyWindowTitle := """" )"
loop 2
SoundBeep, FQ
return
case List[4]:
Clipboard := Output ".HideWindow()"
loop 2
SoundBeep, FQ
return
case List[5]:
Clipboard := Output ".UpdateWindow()"
loop 2
SoundBeep, FQ
return
case List[6]:
Clipboard := Output ".ClearWindow()"
loop 2
SoundBeep, FQ
return
case List[7]:
Clipboard := Output ".DrawBitmap( pBitmap := """" , { X: """" , Y: """" , W: """" , H: """" } , dispose := 1 )"
loop 2
SoundBeep, FQ
return
case List[8]:
Clipboard := Output ".PaintBackground( color := ""0xFF000000"" )"
loop 2
SoundBeep, FQ
return
case List[9]:
Clipboard := Output ".DeleteWindow()"
loop 2
SoundBeep, FQ
return
Default:
ToolTip, Looks like a new case needs to be added
return
}
}
}
;**************************************************************************************************************************************************************************
;**************************************************************************************************************************************************************************
;**************************************************************************************************************************************************************************