所需依赖库下载:
;**************************************************************************************************************************************************************************** #Include <Gdip> ; #Include <PopUpWindow_V2> ; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=94961 ;**************************************************************************************************************************************************************************** ; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3851&p=443722#p443722 #SingleInstance, Force SetBatchlines, -1 CoordMode, Mouse, Screen #NoEnv GDIP_STARTUP() Gui1 := New PopUpWindow( { AutoShow: 1 , X: 0 , Y: 0 , W: 300 , H: 200 , Options: " -DPIScale +AlwaysOnTop " } ) Gui1.PaintBackground( color := "0x66FF0000" , 1 ) Gui, % "1:+AlwaysOnTop +Owner" Gui1.Hwnd Gui, 1:Color, 22262a Gui, 1:Show, w600 h500 Bob := New PositionButtons( { Scale: 3 , Parent: 1 , X: 0 , Y: 0 , Bind: [ Func("MoveUp").Bind( Gui1 ) , Func("MoveDown").Bind( Gui1 ) , Func("MoveLeft").Bind( Gui1 ) , Func("MoveRight").Bind( Gui1 ) ] } ) Bob2 := New PositionButtons( { Parent: 1 , X: 20 , Y: 300 , Bind: [ Func("MoveUp").Bind( Gui1 ) , Func("MoveDown").Bind( Gui1 ) , Func("MoveLeft").Bind( Gui1 ) , Func("MoveRight").Bind( Gui1 ) ] } ) Bob3 := New PositionButtons( { Scale: 0.5 , Parent: 1 , X: 20 , Y: 850 , Bind: [ Func("MoveUp").Bind( Gui1 ) , Func("MoveDown").Bind( Gui1 ) , Func("MoveLeft").Bind( Gui1 ) , Func("MoveRight").Bind( Gui1 ) ] } ) return GuiClose: GuiContextMenu: *ESC::ExitApp RAlt::PopUpWindow.Helper() MoveLeft( obj ){ ( GetKeyState( "ctrl" ) ) ? ( obj.X -= 100 ) : ( GetKeyState( "Shift" ) ) ? ( obj.X -= 10 ) : ( obj.X -= 1 ) obj.UpdateSettings() obj.ShowWindow() } MoveRight( obj ){ ( GetKeyState( "ctrl" ) ) ? ( obj.X += 100 ) : ( GetKeyState( "Shift" ) ) ? ( obj.X += 10 ) : ( obj.X += 1 ) obj.UpdateSettings() obj.ShowWindow() } MoveUp( obj ){ ( GetKeyState( "ctrl" ) ) ? ( obj.Y -= 100 ) : ( GetKeyState( "Shift" ) ) ? ( obj.Y -= 10 ) : ( obj.Y -= 1 ) obj.UpdateSettings() obj.ShowWindow() } MoveDown( obj ){ ( GetKeyState( "ctrl" ) ) ? ( obj.Y += 100 ) : ( GetKeyState( "Shift" ) ) ? ( obj.Y += 10 ) : ( obj.Y += 1 ) obj.UpdateSettings() obj.ShowWindow() } ;************************************************************************************************************************************************************************************************************** ;************************************************************************************************************************************************************************************************************** ;************************************************************************************************************************************************************************************************************** ;************************************************************************************************************************************************************************************************************** ;Written By: Hellbent ;Date: Jan 22nd, 2022 class PositionButtons { __New( obj := "" ){ This._SetDefaults() This._UpdateDefaults( obj ) This._CreateWindow() This._GraphicsSetup() This._AddControls() This._BindControls() This.ShowControl() This.UpdateControl() This._SetHoverTimer() } _SetDefaults(){ This.Smoothing := 2 This.InterpolationMode := 7 This.hbm := "" This.Hwnd := "" This.hdc := "" This.obm := "" This.G := "" This.WindowOptions := " +LastFound +E0x80000 hwndhwnd -Caption " This.Scale := 1 This.Width := 204 This.Height := 109 This.X := 10 This.Y := 10 This.Controls := [] This.Handles := [] This.Controls[ 1 ] := { X: 63 * This.Scale , Y: 15 * This.Scale , W: 78 * This.Scale , H: 40 * This.Scale } This.Controls[ 2 ] := { X: 63 * This.Scale , Y: 56 * This.Scale , W: 78 * This.Scale , H: 40 * This.Scale } This.Controls[ 3 ] := { X: 20 * This.Scale , Y: 28 * This.Scale , W: 40 * This.Scale , H: 56 * This.Scale } This.Controls[ 4 ] := { X: 148 * This.Scale , Y: 28 * This.Scale , W: 40 * This.Scale , H: 56 * This.Scale } This.Bind := [] This.XOffset := 38 This.YOffset := 18 This.ButtonTopHighlightColor := "0xFF3399FF" This.ButtonBottomHighlightColor := "0x66336699" This.HoverTimer := This._MouseHover.Bind( This ) } _UpdateDefaults( obj := "" ){ local k , v , index := 0 for k, v in obj { if( IsObject( obj[ k ] ) ){ for i, j in obj[ k ] { This[ k , i ] := obj[ k , i ] } }else{ This[ k ] := obj[ k ] } } This._Scale() } _Scale(){ This.Width := 204 * This.Scale This.Height := 109 * This.Scale This.X *= This.Scale This.Y *= This.Scale This.Controls[ 1 ] := { X: 63 * This.Scale , Y: 15 * This.Scale , W: 78 * This.Scale , H: 40 * This.Scale } This.Controls[ 2 ] := { X: 63 * This.Scale , Y: 56 * This.Scale , W: 78 * This.Scale , H: 40 * This.Scale } This.Controls[ 3 ] := { X: 20 * This.Scale , Y: 28 * This.Scale , W: 40 * This.Scale , H: 56 * This.Scale } This.Controls[ 4 ] := { X: 148 * This.Scale , Y: 28 * This.Scale , W: 40 * This.Scale , H: 56 * This.Scale } } _SetHoverTimer( state := "" ){ local HoverTimer := This.HoverTimer SetTimer, % HoverTimer , % ( state = "" ) ? ( 60 ) : ( State ) } _MouseHover(){ static index := 0 MouseGetPos,,,, ctrl, 2 if( This.Handles[ ctrl ] && !This.Active ){ This.Active := This.Handles[ ctrl ] This.UpdateControl() }else if( This.Active && This.Handles[ ctrl ] != This.Active && !This.Active := "" ){ This.UpdateControl() } } _OnClick(){ This._SetHoverTimer( "Off" ) This.Pressed := This.Handles[ This._GetControlHwnd() ] This.Active := "" This.UpdateControl() While( GetKeyState( "LButton" ) ) sleep, 60 if( This.Pressed != This.Handles[ This._GetControlHwnd() ] ){ This.Pressed := "" This.Active := This.Handles[ This._GetControlHwnd() ] This.UpdateControl() This._SetHoverTimer() }else{ This.Pressed := "" This.Active := This.Handles[ This._GetControlHwnd() ] This.UpdateControl() if( This.Bind[ This.Active ] ){ try{ This.Bind[ This.Active ].Call() This._SetHoverTimer() return } try{ This._SetHoverTimer() gosub, % This.Bind[ This.Active ] return } } } } _GetControlHwnd(){ local ctrl MouseGetPos,,,, ctrl, 2 return ctrl } _CreateWindow(){ local hwnd Gui , New, % This.WindowOptions " +Parent" This.Parent This.Hwnd := hwnd } _GraphicsSetup(){ This.hbm := CreateDIBSection( This.Width , This.Height ) This.hdc := CreateCompatibleDC() This.obm := SelectObject( This.hdc , This.hbm ) This.G := Gdip_GraphicsFromHDC( This.hdc ) Gdip_SetSmoothingMode( This.G , This.Smoothing ) Gdip_SetInterpolationMode( This.G , This.InterpolationMode ) } _AddControls(){ local hwnd loop, 4 { Gui, % This.Hwnd ":Add", Text, % "x" This.Controls[ A_Index ].X " y" This.Controls[ A_Index ].Y " w" This.Controls[ A_Index ].W " h" This.Controls[ A_Index ].H " hwndhwnd" This.Controls[ A_Index ].Hwnd := hwnd This.Handles[ hwnd ] := A_Index } } _BindControls(){ local bd := This._OnClick.Bind( This ) Loop, 4 GuiControl, % This.Hwnd ":+G" , % This.Controls[ A_Index ].Hwnd , % bd } ShowControl(){ Gui, % This.Hwnd ":Show", } _ClearWindow(){ Gdip_GraphicsClear( This.G ) } _UpdateWindow(){ UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.Width , This.Height ) } UpdateControl(){ This._ClearWindow() This.DrawControlBitmap() This._UpdateWindow() } DrawControlBitmap(){ ;background left Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillEllipse( This.G , Brush , ( 40 - This.XOffset ) * This.Scale , ( 20 - This.YOffset ) * This.Scale , 200 * This.Scale , 105 * This.Scale ) , Gdip_DeleteBrush( Brush ) ;inner circle Brush := Gdip_CreateLineBrushFromRect( ( 40 - This.XOffset ) * This.Scale , ( 25 - This.YOffset ) * This.Scale , 190 * This.Scale , 79 * This.Scale , "0xFF72767a" , "0xFF000000" , 1 , 1 ) , Gdip_FillEllipse( This.G , Brush , ( 45 - This.XOffset ) * This.Scale , ( 26 - This.YOffset ) * This.Scale , 190 * This.Scale , 94 * This.Scale ) , Gdip_DeleteBrush( Brush ) ;*************************************************************************************************************************** ;*************************************************************************************************************************** ;Button 1 if( This.Pressed = 1 ) Brush := Gdip_CreateLineBrushFromRect( ( 102 - This.XOffset ) * This.Scale , ( 34 - This.YOffset ) * This.Scale , 77 * This.Scale , 33 * This.Scale , "0xFF12161a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillRoundedRectangle( This.G , Brush , ( 103 - This.XOffset ) * This.Scale , ( 35 - This.YOffset ) * This.Scale , 74 * This.Scale , 36 * This.Scale , 5 * This.Scale ) , Gdip_DeleteBrush( Brush ) else Brush := Gdip_CreateLineBrushFromRect( ( 102 - This.XOffset ) * This.Scale , ( 34 - This.YOffset ) * This.Scale , 77 * This.Scale , 33 * This.Scale , "0xFF32363a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillRoundedRectangle( This.G , Brush , ( 103 - This.XOffset ) * This.Scale , ( 35 - This.YOffset ) * This.Scale , 74 * This.Scale , 36 * This.Scale , 5 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_CreateLineBrushFromRect( ( 103 - This.XOffset ) * This.Scale , ( 33 - This.YOffset ) * This.Scale , 77 * This.Scale , 36 * This.Scale , "0xFF3F4752" , "0xFF1C2024" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( This.G , Pen , ( 103 - This.XOffset ) * This.Scale , ( 35 - This.YOffset ) * This.Scale , 74 * This.Scale , 36 * This.Scale , 5 * This.Scale ) , Gdip_DeletePen( Pen ) if( This.Pressed = 1 ){ Brush := Gdip_BrushCreateSolid( "0xAA3399FF" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 38 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x99336699" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 53 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) }else if( This.Active = 1 ){ Brush := Gdip_BrushCreateSolid( "0x993399FF" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 38 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x66336699" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 53 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) }else{ Brush := Gdip_BrushCreateSolid( "0x66F0F0F0" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 38 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x66000000" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 53 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) } if( This.Pressed = 1 ) Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "5" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 104 - This.XOffset ) * This.Scale " y" ( 37 - This.YOffset ) * This.Scale , "Webdings" , 74 * This.Scale , 36 * This.Scale ) , Gdip_DeleteBrush( Brush ) else Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "5" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 104 - This.XOffset ) * This.Scale " y" ( 36 - This.YOffset ) * This.Scale , "Webdings" , 74 * This.Scale , 36 * This.Scale ) , Gdip_DeleteBrush( Brush ) ;*************************************************************************************************************************** ;*************************************************************************************************************************** ;Button 2 if( This.Pressed = 2 ){ Brush := Gdip_CreateLineBrushFromRect( ( 107 - This.XOffset ) * This.Scale , ( 78 - This.YOffset ) * This.Scale , 70 * This.Scale , 36 * This.Scale , "0xFF12161a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillRoundedRectangle( This.G , Brush , ( 103 - This.XOffset ) * This.Scale , ( 76 - This.YOffset ) * This.Scale , 74 * This.Scale , 36 * This.Scale , 5 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_CreateLineBrushFromRect( ( 103 - This.XOffset ) * This.Scale , ( 79 - This.YOffset ) * This.Scale , 74 * This.Scale , 35 * This.Scale , "0xFF02050a" , "0xFF22262a" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( This.G , Pen , ( 103 - This.XOffset ) * This.Scale , ( 76 - This.YOffset ) * This.Scale , 74 * This.Scale , 36 * This.Scale , 5 * This.Scale ) , Gdip_DeletePen( Pen ) }else{ Brush := Gdip_CreateLineBrushFromRect( ( 107 - This.XOffset ) * This.Scale , ( 78 - This.YOffset ) * This.Scale , 70 * This.Scale , 36 * This.Scale , "0xFF32363a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillRoundedRectangle( This.G , Brush , ( 103 - This.XOffset ) * This.Scale , ( 76 - This.YOffset ) * This.Scale , 74 * This.Scale , 36 * This.Scale , 5 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_CreateLineBrushFromRect( ( 103 - This.XOffset ) * This.Scale , ( 79 - This.YOffset ) * This.Scale , 74 * This.Scale , 35 * This.Scale , "0xFF3F4752" , "0xFF1C2024" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( This.G , Pen , ( 103 - This.XOffset ) * This.Scale , ( 76 - This.YOffset ) * This.Scale , 74 * This.Scale , 36 * This.Scale , 5 * This.Scale ) , Gdip_DeletePen( Pen ) } if( This.Pressed = 2 ){ Brush := Gdip_BrushCreateSolid( "0xAA3399FF" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 79 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x99336699" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 94 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) }else if( This.Active = 2 ){ Brush := Gdip_BrushCreateSolid( "0x993399FF" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 79 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x66336699" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 94 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) }else{ Brush := Gdip_BrushCreateSolid( "0x66F0F0F0" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 79 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x66000000" ) , Gdip_FillRectangle( This.G , Brush , ( 106 - This.XOffset ) * This.Scale , ( 94 - This.YOffset ) * This.Scale , 68 * This.Scale , 15 * This.Scale ) , Gdip_DeleteBrush( Brush ) } if( This.Pressed = 2 ) Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "6" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 104 - This.XOffset ) * This.Scale " y" ( 77 - This.YOffset ) * This.Scale , "Webdings" , 74 * This.Scale , 36 * This.Scale ) , Gdip_DeleteBrush( Brush ) else Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "6" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 104 - This.XOffset ) * This.Scale " y" ( 76 - This.YOffset ) * This.Scale , "Webdings" , 74 * This.Scale , 36 * This.Scale ) , Gdip_DeleteBrush( Brush ) ;*************************************************************************************************************************** ;*************************************************************************************************************************** ;Button 3 if( This.Pressed = 3 ){ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillPie( This.G , Brush , ( 49 - This.XOffset ) * This.Scale , ( 39 - This.YOffset ) * This.Scale , 95 * This.Scale , 70 * This.Scale , 90 , 180 ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_CreateLineBrushFromRect( ( 51 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 44 * This.Scale , 65 * This.Scale , "0xFF12161a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillPie( This.G , Brush , ( 51 - This.XOffset ) * This.Scale , ( 41 - This.YOffset ) * This.Scale , 89 * This.Scale , 66 * This.Scale , 90 , 180 ) , Gdip_DeleteBrush( Brush ) }else{ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillPie( This.G , Brush , ( 49 - This.XOffset ) * This.Scale , ( 39 - This.YOffset ) * This.Scale , 95 * This.Scale , 70 * This.Scale , 90 , 180 ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_CreateLineBrushFromRect( ( 51 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 44 * This.Scale , 65 * This.Scale , "0xFF32363a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillPie( This.G , Brush , ( 51 - This.XOffset ) * This.Scale , ( 41 - This.YOffset ) * This.Scale , 89 * This.Scale , 66 * This.Scale , 90 , 180 ) , Gdip_DeleteBrush( Brush ) } if( This.Pressed = 3 ) Brush := Gdip_BrushCreateSolid( "0xAA3399FF" ) , Gdip_FillPie( This.G , Brush , ( 53 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 180 , 90 ) , Gdip_DeleteBrush( Brush ) else if( This.Active = 3 ) Brush := Gdip_BrushCreateSolid( "0x993399FF" ) , Gdip_FillPie( This.G , Brush , ( 53 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 180 , 90 ) , Gdip_DeleteBrush( Brush ) else Brush := Gdip_BrushCreateSolid( "0x66F0F0F0" ) , Gdip_FillPie( This.G , Brush , ( 53 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 180 , 90 ) , Gdip_DeleteBrush( Brush ) if( This.Pressed = 3 ) Brush := Gdip_BrushCreateSolid( "0x99336699" ) , Gdip_FillPie( This.G , Brush , ( 53 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 90 , 90 ) , Gdip_DeleteBrush( Brush ) else if( This.Active = 3 ) Brush := Gdip_BrushCreateSolid( "0x66336699" ) , Gdip_FillPie( This.G , Brush , ( 53 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 90 , 90 ) , Gdip_DeleteBrush( Brush ) else Brush := Gdip_BrushCreateSolid( "0x66000000" ) , Gdip_FillPie( This.G , Brush , ( 53 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 90 , 90 ) , Gdip_DeleteBrush( Brush ) if( This.Pressed = 3 ) Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "3" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 49 - This.XOffset ) * This.Scale " y" ( 40 - This.YOffset ) * This.Scale , "Webdings" , 55 * This.Scale , 70 * This.Scale ) , Gdip_DeleteBrush( Brush ) else Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "3" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 49 - This.XOffset ) * This.Scale " y" ( 39 - This.YOffset ) * This.Scale , "Webdings" , 55 * This.Scale , 70 * This.Scale ) , Gdip_DeleteBrush( Brush ) ;*************************************************************************************************************************** ;*************************************************************************************************************************** ;Button 4 if( This.Pressed = 4 ){ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillPie( This.G , Brush , ( 136 - This.XOffset ) * This.Scale , ( 39 - This.YOffset ) * This.Scale , 95 * This.Scale , 70 * This.Scale , 90 , -180 ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_CreateLineBrushFromRect( ( 51 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 44 * This.Scale , 65 * This.Scale , "0xFF12161a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillPie( This.G , Brush , ( 140 - This.XOffset ) * This.Scale , ( 41 - This.YOffset ) * This.Scale , 89 * This.Scale , 66 * This.Scale , 90 , -180 ) , Gdip_DeleteBrush( Brush ) }else{ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillPie( This.G , Brush , ( 136 - This.XOffset ) * This.Scale , ( 39 - This.YOffset ) * This.Scale , 95 * This.Scale , 70 * This.Scale , 90 , -180 ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_CreateLineBrushFromRect( ( 51 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 44 * This.Scale , 65 * This.Scale , "0xFF32363a" , "0xFF22262a" , 1 , 1 ) , Gdip_FillPie( This.G , Brush , ( 140 - This.XOffset ) * This.Scale , ( 41 - This.YOffset ) * This.Scale , 89 * This.Scale , 66 * This.Scale , 90 , -180 ) , Gdip_DeleteBrush( Brush ) } if( This.Pressed = 4 ){ Brush := Gdip_BrushCreateSolid( "0xAA3399FF" ) , Gdip_FillPie( This.G , Brush , ( 146 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , -90 , 90 ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x99336699" ) , Gdip_FillPie( This.G , Brush , ( 146 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 90 , -90 ) , Gdip_DeleteBrush( Brush ) }else if( This.Active = 4 ){ Brush := Gdip_BrushCreateSolid( "0x993399FF" ) , Gdip_FillPie( This.G , Brush , ( 146 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , -90 , 90 ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x66336699" ) , Gdip_FillPie( This.G , Brush , ( 146 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 90 , -90 ) , Gdip_DeleteBrush( Brush ) }else{ Brush := Gdip_BrushCreateSolid( "0x66F0F0F0" ) , Gdip_FillPie( This.G , Brush , ( 146 - This.XOffset ) * This.Scale , ( 44 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , -90 , 90 ) , Gdip_DeleteBrush( Brush ) Brush := Gdip_BrushCreateSolid( "0x66000000" ) , Gdip_FillPie( This.G , Brush , ( 146 - This.XOffset ) * This.Scale , ( 46 - This.YOffset ) * This.Scale , 81 * This.Scale , 59 * This.Scale , 90 , -90 ) , Gdip_DeleteBrush( Brush ) } if( This.Pressed = 4 ) Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "4" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 179 - This.XOffset ) * This.Scale " y" ( 40 - This.YOffset ) * This.Scale , "Webdings" , 55 * This.Scale , 70 * This.Scale ) , Gdip_DeleteBrush( Brush ) else Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_TextToGraphics( This.G , "4" , "s" 22 * This.Scale " Center vCenter c" Brush " x" ( 179 - This.XOffset ) * This.Scale " y" ( 39 - This.YOffset ) * This.Scale , "Webdings" , 55 * This.Scale , 70 * This.Scale ) , Gdip_DeleteBrush( Brush ) ;inner circle ;*************************************************************************************************************************** ;*************************************************************************************************************************** ;~ Brush := Gdip_BrushCreateSolid( "0x2266AAFF" ) , Gdip_FillEllipse( This.G , Brush , ( 45 - This.XOffset ) * This.Scale , ( 26 - This.YOffset ) * This.Scale , 190 * This.Scale , 94 * This.Scale ) , Gdip_DeleteBrush( Brush ) } } ;************************************************************************************************************************************************************************************************************** ;#################################################################################################################################################################################### class PopUpWindow { ;PopUpWindow v2 ;Date Written: Oct 28th, 2021 ;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 return hwnd } 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(){ 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(){ UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H ) } ClearWindow( AutoUpdate := 0 ){ 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( { 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 )" , PaintBackground: ".PaintBackground( color := ""0xFF000000"" ) " ";{ 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: """" , BoundClass: """" , BoundMethod: """" } )" , DrawTriggers: ".DrawTriggers( color := ""0xFFFF0000"" , AutoUpdate := 0 )" , CreateCachedBitmap: ".CreateCachedBitmap( pBitmap , Dispose := 0 )" , DrawCachedBitmap: ".DrawCachedBitmap( AutoUpdate := 0 )" , DisposeCachedbitmap: ".DisposeCachedbitmap()" } clipboard := Out ClipList[ A_GuiControl ] } }
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)