You can find it here.
viewtopic.php?f=18&t=89417&p=484882#p484882
Code: Select all
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#SingleInstance Force
SetBatchLines, -1
;;*******************************************
Gui1 := {}
Gui1.Scale := 1
Gui, New, +AlwaysOnTop +hwndhwnd -DPIScale
Gui1.Hwnd := hwnd
Gui1.MarginX := 10
Gui1.MarginY := 10
Gui, % Gui1.Hwnd ":Margin", % Gui1.MarginX , % Gui1.MarginY
;*******************************************
Gui1.FontType := "Segoe UI"
Gui1.FontSize := 9
Gui1.FontColor := "000000"
Gui1.FontOptions := ""
SetWindowFont( Gui1 )
;;*******************************************
Gui1.Controls := {}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;Control Name Parent Object , Control Type , Options , Display Value , Rows
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gui1.Controls.ColorListBox := CreateControl( Gui1 , "ListBox" , "xm ym w250 h200 Multi" , "hwnd|posX||posY|posW|posH|Type|WinObj|DisplayValue|Options|" )
Gui1.Controls.CheckMeCheckBox := CreateControl( Gui1 , "Checkbox" , "x+m yp Checked section " , "Check Me!" )
Gui1.Controls.HideButton := CreateControl( Gui1 , "Button" , "xs y+m wp" , "Hide" )
Gui1.Controls.ShowButton := CreateControl( Gui1 , "Button" , "xs y+m wp" , "Show" )
Gui1.Controls.Option1Radio := CreateControl( Gui1 , "Radio" , "xs y+m wp Checked" , "Option 1" )
Gui1.Controls.Option2Radio := CreateControl( Gui1 , "Radio" , "xs y+m wp" , "Option 2" )
Gui1.Controls.TTestDDL := CreateControl( Gui1 , "DDL" , "xs y+m w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gui1.Controls.TTestDDL2 := CreateControl( Gui1 , "DDL" , "xs y+m w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
Gui1.Controls.TTestDDL3 := CreateControl( Gui1 , "DDL" , "xs y+m w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
Gui1.Controls.TTestDDL4 := CreateControl( Gui1 , "DDL" , "xs y+m w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
Gui1.Controls.TTestComboBox1 := CreateControl( Gui1 , "ComboBox" , "xs y+m w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
Gui1.Controls.extraButton1 := CreateControl( Gui1 , "Button" , "x+10 ym w120" , "Extra Button 1" )
Gui1.Controls.extraButton2 := CreateControl( Gui1 , "Button" , "xp y+10 wp" , "Extra Button 2" )
Gui1.Controls.extraButton3 := CreateControl( Gui1 , "Button" , "xp y+10 wp" , "Extra Button 3" )
Gui1.Controls.extraButton4 := CreateControl( Gui1 , "Button" , "xp y+10 wp" , "Extra Button 4" )
Gui1.Controls.extraButton5 := CreateControl( Gui1 , "Button" , "xp y+10 wp" , "Extra Button 5" )
Gui1.Controls.extraButton6 := CreateControl( Gui1 , "Button" , "xp y+10 wp" , "Extra Button 6" )
Gui1.Controls.extraButton7 := CreateControl( Gui1 , "Button" , "xp y+10 wp" , "Extra Button 7" )
Gui1.Controls.extraListBox1 := CreateControl( Gui1 , "ListBox" , "xm w250 r9" , "hwnd|posX||posY|posW|posH|Type|WinObj|DisplayValue|Options|" )
Gui1.Controls.extraEdit1 := CreateControl( Gui1 , "Edit" , "x+10 yp w200 r3" , "hwnd|posX||posY|posW|posH|Type|WinObj|DisplayValue|Options|" )
Gui1.Controls.extraEdit2 := CreateControl( Gui1 , "Edit" , "xp y+m w200 r3" , "hwnd|posX||posY|posW|posH|Type|WinObj|DisplayValue|Options|" )
Gui1.Controls.TestTab1 := CreateControl( Gui1 , "Tab3" , "xp y+m w300 r3 section" , "Tab 1|Tab 2||Tab 3|" )
Gui, % Gui1.Hwnd ":Tab",
Gui1.Controls.TestPicture1 := CreateControl( Gui1 , "Picture" , "xm ys+20 w200 h-1" , "TestImage.png" )
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gui, Show, AutoSize , Simple Gui Scaling
;;*******************************************
Gui1.Scale := A_ScreenDPI / 96
ScaleControls( Gui1 , Gui1.Scale )
;;*******************************************
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HOTKEYS
~$WheelUp:: ScaleControls( Gui1 , Gui1.Scale += 0.1 )
;;*******************************************
~$WheelDown:: ScaleControls( Gui1 , Gui1.Scale -= 0.1 )
;;*******************************************
F1:: ScaleControls( Gui1 , Gui1.Scale := 1 )
;;*******************************************
F2:: ScaleControls( Gui1 , Gui1.Scale := 1.5 )
;;*******************************************
F3:: ScaleControls( Gui1 , Gui1.Scale := 2 )
;;*******************************************
F4:: ScaleControls( Gui1 , Gui1.Scale := .7 )
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ScaleControls( Gui1 , Scale := 1 ){
static lastSize
for k , v in Gui1.Controls {
cc := Gui1.Controls[ k ]
x := cc.X * Scale
y := cc.Y * Scale
w := cc.W * Scale
if( cc.Rows )
h := cc.Rows * GetRowHeight( cc.FontType , size , cc.FontOptions ) + cc.Rows * ( 2.6 * Scale )
else
h := cc.H * Scale
size := ( cc.FontSize / ( A_ScreenDPI / 96 ) ) * scale
if( size != lastSize && lastSize := Size )
Gui, % Gui1.Hwnd ":Font" , % "norm s" size " c" cc.FontColor " " cc.FontOptions , % cc.FontType
GuiControl, % Gui1.Hwnd ":Font" , % cc.Hwnd
GuiControl, % Gui1.Hwnd ":MoveDraw" , % cc.Hwnd , % "x" X " y" Y " w" W " h" H
}
Gui, % Gui1.hwnd ":Margin", % Gui1.MarginX * scale , % Gui1.MarginY * scale
Gui, % Gui1.Hwnd ":Show" , AutoSize
}
;;*******************************************
GetRowHeight( FontType , FontSize , FontOptions ){
Gui, Dummy:Font, % "s" FontSize " " FontOptions , % FontType
Gui, Dummy:Add, Text,, % "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyyYzZ1!2@3#4$5%6^7&8*9(0)-_=+[{]}\|,<.>/?"
GuiControlGet, pos , Dummy:pos , static1
Gui, Dummy:Destroy
return posH
}
;;*******************************************
SetWindowFont( Gui1 ){
local size := Gui1.FontSize / ( A_ScreenDPI / 96 )
Gui, % Gui1.Hwnd ":Font" , % "norm s" size " c" Gui1.FontColor " " Gui1.FontOptions , % Gui1.FontType
}
;;*******************************************
CreateControl( WinObj , Type := "Button" , Options := "" , DisplayValue := "" , Rows := "" ){
local obj := {}
Gui, % WinObj.Hwnd ":Add" , % Type , % Options " +hwndhwnd" , % DisplayValue
GuiControlGet, pos , % WinObj.Hwnd ":pos" , % hwnd
obj.Hwnd := hwnd
obj.Rows := Rows
obj.X := posX
obj.Y := posY
obj.W := posW
obj.H := posH
obj.Type := Type
obj.Parent := WinObj.Hwnd
obj.DisplayValue := DisplayValue
obj.Options := Options
obj.FontType := WinObj.FontType
obj.FontSize := WinObj.FontSize
obj.FontColor := WinObj.FontColor
obj.FontOptions := WinObj.FontOptions
return obj
}
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I'm glad you liked it.
Code: Select all
;Before:
Gui, % Gui1.Hwnd ":Font" , % "s" size
;After:
Gui, % Gui1.Hwnd ":Font" , % "norm s" size " c" cc.FontColor " " cc.FontOptions , % cc.FontType
Code: Select all
#SingleInstance Force
SetBatchLines, -1
;*******************************************
Gui1 := {}
Gui1.Scale := 1
;*******************************************
Gui, New, +AlwaysOnTop +hwndhwnd -DPIScale +Resize
Gui1.Hwnd := hwnd
;*******************************************
Gui1.MarginX := 10
Gui1.MarginY := 10
Gui, % Gui1.Hwnd ":Margin", % Gui1.MarginX , % Gui1.MarginY
;*******************************************
Gui1.FontType := "Segoe UI"
Gui1.FontSize := 9
Gui1.FontColor := "000000"
Gui1.FontOptions := ""
SetWindowFont( Gui1 )
;;*******************************************
Gui1.Controls := {}
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;Control Name Parent Object , Control Type , Options , Display Value , Rows
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gui1.Controls.ColorListBox := CreateControl( Gui1 , "ListBox" , "xm ym w250 h200 Multi" , "hwnd|posX||posY|posW|posH|Type|WinObj|DisplayValue|Options|" )
Gui1.Controls.CheckMeCheckBox := CreateControl( Gui1 , "Checkbox" , "x+m yp Checked section " , "Check Me!" )
Gui1.Controls.HideButton := CreateControl( Gui1 , "Button" , "xs y+m wp" , "Hide" )
Gui1.Controls.ShowButton := CreateControl( Gui1 , "Button" , "xs y+m wp" , "Show" )
Gui1.Controls.Option1Radio := CreateControl( Gui1 , "Radio" , "xs y+m wp Checked" , "Option 1" )
Gui1.Controls.Option2Radio := CreateControl( Gui1 , "Radio" , "xs y+m wp" , "Option 2" )
Gui1.Controls.TTestDDL := CreateControl( Gui1 , "DDL" , "xs y+m w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gui, Show, AutoSize , Scale via +Resize
;;*******************************************
WinGetPos,,, w , h , % "ahk_id " Gui1.Hwnd
Gui1.W := w
Gui1.H := h
;;*******************************************
Gui1.Scale := A_ScreenDPI / 96
ScaleControls( Gui1 , Gui1.Scale )
;;*******************************************
return ;<<<<---- End of the auto-exectute section of the script.
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit Routine
GuiClose:
GuiContextMenu:
*ESC::ExitApp
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +RESIZE
GuiSize: ;{
if( !init && init := 1 )
return
WinGetPos,,, w, h , % "ahk_id " Gui1.Hwnd
Gui1.Scale := w / Gui1.W
ScaleControls( Gui1 , Gui1.Scale )
sleep, 30
return
;}
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HOTKEYS
F1:: ScaleControls( Gui1 , Gui1.Scale := 1 )
;;*******************************************
F2:: ScaleControls( Gui1 , Gui1.Scale := 1.5 )
;;*******************************************
F3:: ScaleControls( Gui1 , Gui1.Scale := 2 )
;;*******************************************
F4:: ScaleControls( Gui1 , Gui1.Scale := .7 )
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Functions
ScaleControls( Gui1 , Scale := 1 ){
static lastSize
for k , v in Gui1.Controls {
cc := Gui1.Controls[ k ]
x := cc.X * Scale
y := cc.Y * Scale
w := cc.W * Scale
if( cc.Rows )
h := cc.Rows * GetRowHeight( cc.FontType , size , cc.FontOptions )
else
h := cc.H * Scale
size := ( cc.FontSize / ( A_ScreenDPI / 96 ) ) * scale
if( size != lastSize && lastSize := Size )
Gui, % Gui1.Hwnd ":Font" , % "norm s" size " c" cc.FontColor " " cc.FontOptions , % cc.FontType
GuiControl, % Gui1.Hwnd ":Font" , % cc.Hwnd
GuiControl, % Gui1.Hwnd ":MoveDraw" , % cc.Hwnd , % "x" X " y" Y " w" W " h" H
}
Gui, % Gui1.hwnd ":Margin", % Gui1.MarginX * scale , % Gui1.MarginY * scale
Gui, % Gui1.Hwnd ":Show" , AutoSize
}
;;*******************************************
GetRowHeight( FontType , FontSize , FontOptions ){
Gui, Dummy:Font, % "s" FontSize " " FontOptions , % FontType
Gui, Dummy:Add, Text,, % "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyyYzZ1!2@3#4$5%6^7&8*9(0)-_=+[{]}\|,<.>/?"
GuiControlGet, pos , Dummy:pos , static1
Gui, Dummy:Destroy
return posH
}
;;*******************************************
SetWindowFont( Gui1 ){
local size := Gui1.FontSize / ( A_ScreenDPI / 96 )
Gui, % Gui1.Hwnd ":Font" , % "norm s" size " c" Gui1.FontColor " " Gui1.FontOptions , % Gui1.FontType
}
;;*******************************************
CreateControl( WinObj , Type := "Button" , Options := "" , DisplayValue := "" , Rows := "" ){
local obj := {}
Gui, % WinObj.Hwnd ":Add" , % Type , % Options " +hwndhwnd" , % DisplayValue
GuiControlGet, pos , % WinObj.Hwnd ":pos" , % hwnd
obj.Hwnd := hwnd
obj.Rows := Rows
obj.X := posX
obj.Y := posY
obj.W := posW
obj.H := posH
obj.Type := Type
obj.Parent := WinObj.Hwnd
obj.DisplayValue := DisplayValue
obj.Options := Options
obj.FontType := WinObj.FontType
obj.FontSize := WinObj.FontSize
obj.FontColor := WinObj.FontColor
obj.FontOptions := WinObj.FontOptions
return obj
}
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Code: Select all
;Many Thanks to tic (Tariq Porter) for his GDI+ Library
;Many Thanks to Hellbent for his functions of buttons, switches, tabs, and help in learning ahk
;######################################################################################################################################
;##################################################### ###################################
;##################################################### sec. global settings ###################################
;##################################################### ###################################
;######################################################################################################################################
;###### "21b9eb" // cAqua or cGreen // "008000" or cWhite // "FFFFFF" or cBlack // "000000" or dark grey \\ 333437 or purple \\ 1177dd
;######################################################################################################################################
#NoEnv
#NoTrayIcon
#SingleInstance,Ignore
SendMode Input
SetWorkingDir %A_ScriptDir%
Gdip_Startup()
global Hov:=[]
global up:=[]
global Config:=[]
Config[2] := "2B2728" ;all-background
Config[3] := "00FFFF" ;tab-outline
Config[4] := "445" ;total width of app
Config[5] := "220" ;total height of app
Config[6] := "Lucida Console" ;font background
Config[7] := "cAqua" ;color font background
Config[8] := "10" ;font size background
Config[9] := "Lucida Console" ;switch button font
Config[10] := "00FFFF" ;switch button font color
Config[11] := "15" ;switch button font size
size25 := % Config[4] - 25
size50 := % Config[4] - 50
;######################################################################################################################################
;##################################################### ###################################
;##################################################### sec.DPI Scaling ###################################
;##################################################### ###################################
;######################################################################################################################################
RegRead, PC_DPI, HKEY_CURRENT_USER, Control Panel\Desktop\WindowMetrics, AppliedDPI
;---100 percent----
if PC_DPI = 96
{
config[8] :="s" config[8]
config[11] :="s" config[11]
config[14] :="s" config[14]
}
;---125 percent----
if PC_DPI = 120
{
config[8]:="s" config[8] - 2
config[11]:="s" config[11]
config[14]:="s" config[14]
}
;---150 percent----
if PC_DPI = 144
{
config[8]:="s" config[8] - 3
config[11]:="s" config[11]
config[14]:="s" config[14]
}
;---175 percent----
if PC_DPI = 168
{
config[8]:="s" config[8] - 4
config[11]:="s" config[11]
config[14]:="s" config[14]
}
;######################################################################################################################################
;##################################################### ###################################
;##################################################### section.gui main ###################################
;##################################################### ###################################
;######################################################################################################################################
Gui,1:Destroy
Gui,1:new
Gui,1: -Caption -DPIScale
Gui,1:Color,% Config[2],% Config[2]
Gui,1:Font,% config[8] Config[7] , % Config[6]
Gui,1:Add,Text, x0 y0 w%size50% h30 BackgroundTrans gMove_Window,
Gui,1:Add,Text, x%size50% y5 w25 h30 BackgroundTrans gMin_Window,_
Gui,1:Add,Text, x%size25% y5 w25 h30 BackgroundTrans gGuiClose,X
;-------------------------------------
Gui,1:Add, Text, x120 y30 w80 h35 , Title Text
Gui,1:Add, Edit, x120 y160 w315 h20 vSearch,
Hov.push(New Button(345,190,100,25,,"Submit","Submit","ff0000"))
up1:=New OnOff(130,120,,State:=up[1])
;-------------------------------------
Gui,1:Show,% "w"Config[4] " h"Config[5],
SetTimer, Hov_Hover , 50
OnMessage(WM_SYSCOMMAND := 0x0112, "On_WM_SYSCOMMAND")
return
;######################################################################################################################################
;##################################################### ###################################
;##################################################### section.Commands ###################################
;##################################################### ###################################
;######################################################################################################################################
Move_Window() {
SetTimer , Hov_Hover , Off
PostMessage , 0xA1 , 2
While( GetKeyState( "LButton" ) )
sleep , 10
SetTimer , Hov_Hover , On
}
Min_Window() {
Gui , 1: Minimize
}
GuiClose(){
ExitApp
}
On_WM_SYSCOMMAND(W, L) {
Static HTCLOSE := 20
Static HTNOWHERE := 0
Static SC_CLOSE := 0xF060
Static WM_NCHITTEST := 0x0084
If ((W & 0xFFF0) = SC_CLOSE) {
LW := L & 0xFFFF
HW := L >> 16
Gui, %A_Gui%:+LastFound
HGUI := WinExist()
SendMessage, %WM_NCHITTEST%, 0, L, , ahk_id %HGUI%
If (ErrorLevel <> HTCLOSE) ; will restrict closing to the close button in the caption
If (ErrorLevel = HTNOWHERE) ; will prevent closing via taskbar menu and Alt+F4
Return 0
}
}
;##############################################################################################################################
Submit:
Gui, Submit , NoHide
return
;##############################################################################################################################
;##################################################### ###################################
;##################################################### sec.switch on commands ###################################
;##################################################### ###################################
;##############################################################################################################################
updateselected:
GuiControl,,displayupdate, Batch Started
if(up1.state=1){
GuiControl,,displayupdate, Running
}
if(up2.state=1){
GuiControl,,displayupdate, Running
}
GuiControl,,displayupdate, Batch Done
return
;######################################################################################################################
;##################################################### ###################################
;##################################################### sec.Hover ###################################
;##################################################### ###################################
;######################################################################################################################
Hov_Hover(){
static Hover_On,Index
MouseGetPos,,,,ctrl,2
if(!Hover_On&&ctrl){
Loop,% Hov.Length() {
if(ctrl=Hov[A_Index].Hwnd)
Hov[A_Index].Draw_Hover(),Index:=A_Index,Hover_On:=1,break
}
}else if(Hover_On){
if(Hov[Index].Hwnd!=ctrl)
Hov[Index].Draw_Default(),Hover_On:=0
}
}
;#######################################################################################################################
;##################################################### ###################################
;##################################################### sec.Radio ###################################
;##################################################### ###################################
;#######################################################################################################################
class Radio_Button {
__New(x,y,w:=19,Text:="Text",Font:="Arial",FontSize:= "10 Bold" , FontColor:="FFFFFF" ,Window:="1",Background_Color:="36373A",HighLightColor:="1A1C1F",State:=0,GroupArray:=""){
This.State:=State
This.X:=x
This.Y:=y
This.W:=W
This.H:=19
This.Text:=Text
This.Font:=Font
This.FontSize:=FontSize
This.FontColor:="0xFF" FontColor
This.HighLightColor:= "0xFF" HighLightColor
This.GroupArray:=GroupArray
This.Name:=This.GroupArray.Length()+1
This.Background_Color:="0xFF" Background_Color
This.Window:=Window
This.Create_Off_Bitmap()
This.Create_On_Bitmap()
This.Create_Trigger()
sleep,20
if(This.State)
This.Draw_On()
else
This.Draw_Off()
udb := THIS.UpdateValue.BIND( THIS )
SetTimer,% udb,-100
}
Create_Trigger(){
Gui , % This.Window ": Add" , Picture , % "x" This.X " y" This.Y " w" This.W " h" This.H " 0xE hwndHwnd"
This.Hwnd:=hwnd
BD := THIS.Switch_State.BIND( THIS )
GUICONTROL +G , % This.Hwnd , % BD
}
Create_Off_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W , 19 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , 21 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF313436" )
Gdip_FillEllipse( G , Brush , 1 , 1 , 17 , 17 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF1A1C1F" )
Gdip_FillEllipse( G , Brush , 1 , 0 , 17 , 17 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 7 , 1 , 10 , 14 , "0xFF60646A" , "0xFF393B3F" , 1 , 1 )
Gdip_FillEllipse( G , Brush , 2 , 1 , 15 , 15 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 7 , 2 , 10 , 14 , "0xFF4A4D52" , "0xFF393B3F" , 1 , 1 )
Gdip_FillEllipse( G , Brush , 3 , 2 , 13 , 13 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF4D5055" )
Gdip_FillEllipse( G , Brush , 7 , 7 , 5 , 6 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF222325" )
Gdip_FillEllipse( G , Brush , 7 , 6 , 5 , 5 )
Gdip_DeleteBrush( Brush )
;-------------------------------------------------------------
Brush := Gdip_BrushCreateSolid( This.FontColor )
Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " vCenter c" Brush " x23 y0" , This.Font , This.W-23, This.H )
Gdip_DeleteBrush( Brush )
;-------------------------------------------------------------
Gdip_DeleteGraphics( G )
This.Off_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_On_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W , 19 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , 21 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF484A4B" )
Gdip_FillEllipse( G , Brush , 1 , 1 , 17 , 17 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF1A1C1F" )
Gdip_FillEllipse( G , Brush , 1 , 0 , 17 , 17 )
Gdip_DeleteBrush( Brush )
;Brush := Gdip_BrushCreateSolid( "0xFF29292F" ) ;replaced this
Brush := Gdip_BrushCreateSolid( This.HighLightColor ) ; with this
Gdip_FillEllipse( G , Brush , 2 , 1 , 15 , 15 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 5 , 1 , 10 , 14 , "0xFF2E2F31" , "0xFF333337" , 1 , 1 )
Gdip_FillEllipse( G , Brush , 3 , 2 , 13 , 13 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF4D5055" )
Gdip_FillEllipse( G , Brush , 7 , 7 , 5 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.HighLightColor )
Gdip_FillEllipse( G , Brush , 7 , 6 , 5 , 5 )
Gdip_DeleteBrush( Brush )
;Adding text
;-------------------------------------------------------------
Brush := Gdip_BrushCreateSolid( This.FontColor )
Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " vCenter c" Brush " x23 y0" , This.Font , This.W-23, This.H )
Gdip_DeleteBrush( Brush )
;-------------------------------------------------------------
Gdip_DeleteGraphics( G )
This.On_Bitmap := Gdip_CreateHBITMAPFromBitmap( pBitmap )
Gdip_DisposeImage( pBitmap )
}
UpdateValue(){
Loop,% This.GroupArray.Length()
if(This.GroupArray[A_Index].State=1){
lc:=A_Index
Loop,% This.GroupArray.Length()
This.GroupArray[A_Index].Value:=lc
}
}
Switch_State(){
if(This.State!=1){
This.State:=1
This.Draw_On()
Loop,% This.GroupArray.Length() {
if(This.GroupArray[A_Index].Name!=This.Name){
This.GroupArray[A_Index].State:=0
This.GroupArray[A_Index].Draw_Off()
}
}
Loop,% This.GroupArray.Length() {
if(This.GroupArray[A_Index].State=1){
This.Value:=A_Index
break
}
}
Loop,% This.GroupArray.Length() {
This.GroupArray[A_Index].Value:=This.Value
}
}
}
Draw_Off(){
SetImage( This.Hwnd , This.Off_Bitmap )
}
Draw_On(){
SetImage( This.Hwnd , This.On_Bitmap )
}
}
;####################################################################################################################
;##################################################### ###################################
;##################################################### sec.onoff ###################################
;##################################################### ###################################
;####################################################################################################################
class OnOff{
__New(x:="",y:="", window:="1", State:="", Background_Color:="", Text:="", Font:="", Font_Size:="", Font_Color:="", Y_Offset:="0"){
This.X:=x
This.Y:=y
This.W:=90
This.H:=30
This.Window:=window
This.Label:=""
This.State:=State
This.Text:=Text
This.Font:=Config[9]
This.Font_Size:=Config[11]
This.Font_Color:="0xFF" Font_Color
This.Background_Color:="0xFF" Background_Color
This.Y_Offset:=y_Offset
This.Create_Trigger()
This.Create_Off_Bitmap()
This.Create_On_Bitmap()
sleep, 20
(This.State=1)?(This.Draw_On()):(This.Draw_Off())
}
Create_Trigger(){
local hwnd
Gui,% This.Window ":Add",Picture,% "x" This.X " y" This.Y " w" This.W " h" This.H " hwndhwnd 0xE"
This.Hwnd:=hwnd
BP:=This.Switch_States.Bind(This)
GuiControl,% This.Window ":+G",% This.Hwnd,% BP
if(This.Label)
(isFunc(This.Label))?(This.Function:=Func(This.Label))
}
Create_Off_Bitmap( ScaleFactor := .40 ){
pBitmap:=Gdip_CreateBitmap( 180 * ScaleFactor , 74 * ScaleFactor ), G := Gdip_GraphicsFromImage( pBitmap ), Gdip_SetSmoothingMode( G , 4 )
Brush := Gdip_BrushCreateSolid( "0xFF2B2728" ) , Gdip_FillRectangle( G , Brush , 1 * ScaleFactor , 1 * ScaleFactor , 190 * ScaleFactor , 90 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 * ScaleFactor , 0 * ScaleFactor , 180 * ScaleFactor , 74 * ScaleFactor , "0xFF030504" , "0xFF545454" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 1 * ScaleFactor , 1 * ScaleFactor , 177 * ScaleFactor , 71 * ScaleFactor , 25 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 160 * ScaleFactor , 54 * ScaleFactor , 26 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF111111" ) , Gdip_FillEllipse( G , Brush , 12 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF111111" ) , Gdip_FillEllipse( G , Brush , 118 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF101010" ) , Gdip_FillRoundedRectangle( G , Brush , 30 * ScaleFactor , 12 * ScaleFactor , 110 * ScaleFactor , 50 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillEllipse( G , Brush , 12 * ScaleFactor , 12 * ScaleFactor , 46 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF101010" ) , Gdip_FillRoundedRectangle( G , Brush , 50 * ScaleFactor , 21 * ScaleFactor , 100 * ScaleFactor , 40 * ScaleFactor , 8 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillEllipse( G , Brush , 66 * ScaleFactor , 12 * ScaleFactor , 46 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillRoundedRectangle( G , Brush , 27 * ScaleFactor , 12 * ScaleFactor , 60 * ScaleFactor , 50 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF101010" ) , Gdip_FillEllipse( G , Brush , 127 * ScaleFactor , 21 * ScaleFactor , 40 * ScaleFactor , 40 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF800000" ) , Gdip_TextToGraphics( G , "OFF" , "s" This.Font_Size " Center vcenter c" Brush " x" 87 * ScaleFactor " y" 15 * ScaleFactor , This.Font , 100 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 60 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 12 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillRoundedRectangle( G , Brush , 30 * ScaleFactor , 12 * ScaleFactor , 60 * ScaleFactor , 50 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF0C0E0D" ) , Gdip_FillEllipse( G , Brush , 63 * ScaleFactor , 20 * ScaleFactor , 43 * ScaleFactor , 39 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF0C0E0D" ) , Gdip_FillEllipse( G , Brush , 16 * ScaleFactor , 20 * ScaleFactor , 43 * ScaleFactor , 39 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF0C0E0D" ) , Gdip_FillRoundedRectangle( G , Brush , 30 * ScaleFactor , 20 * ScaleFactor , 58 * ScaleFactor , 39 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 73 * ScaleFactor , 19 * ScaleFactor , 34 * ScaleFactor , 34 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 15 * ScaleFactor , 19 * ScaleFactor , 34 * ScaleFactor , 34 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillRoundedRectangle( G , Brush , 30 * ScaleFactor , 19 * ScaleFactor , 60 * ScaleFactor , 34 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillPie( G , Brush , 19 * ScaleFactor , 14 * ScaleFactor , 85 * ScaleFactor , 27 * ScaleFactor , 0 , 180 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillPie( G , Brush , 68 * ScaleFactor , 19 * ScaleFactor , 36 * ScaleFactor , 19 * ScaleFactor , 0 , -90 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillPie( G , Brush , 19 * ScaleFactor , 19 * ScaleFactor , 36 * ScaleFactor , 19 * ScaleFactor , 180 , 90 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillRectangle( G , Brush , 33 * ScaleFactor , 19 * ScaleFactor , 54 * ScaleFactor , 10 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G ),This.Switch_Off_Bitmap:=Gdip_CreateHBITMAPFromBitmap(pBitmap),Gdip_DisposeImage(pBitmap)
}
Create_On_Bitmap( ScaleFactor := .40 ){
pBitmap := Gdip_CreateBitmap( 180 * ScaleFactor , 74 * ScaleFactor ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 4 )
Brush := Gdip_BrushCreateSolid( "0xFF2B2728" ) , Gdip_FillRectangle( G , Brush , 1 * ScaleFactor , 1 * ScaleFactor , 190 * ScaleFactor , 90 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 * ScaleFactor , 0 * ScaleFactor , 180 * ScaleFactor , 74 * ScaleFactor , "0xFF030504" , "0xFF545454" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 1 * ScaleFactor , 1 * ScaleFactor , 177 * ScaleFactor , 71 * ScaleFactor , 25 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillRoundedRectangle( G , Brush , 10 * ScaleFactor , 10 * ScaleFactor , 160 * ScaleFactor , 54 * ScaleFactor , 26 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF111111" ) , Gdip_FillEllipse( G , Brush , 12 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF111111" ) , Gdip_FillEllipse( G , Brush , 118 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF101010" ) , Gdip_FillRoundedRectangle( G , Brush , 30 * ScaleFactor , 12 * ScaleFactor , 110 * ScaleFactor , 50 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF101010" ) , Gdip_FillRoundedRectangle( G , Brush , 28 * ScaleFactor , 21 * ScaleFactor , 100 * ScaleFactor , 40 * ScaleFactor , 8 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillEllipse( G , Brush , 69 * ScaleFactor , 12 * ScaleFactor , 46 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillRoundedRectangle( G , Brush , 87 * ScaleFactor , 12 * ScaleFactor , 60 * ScaleFactor , 50 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF101010" ) , Gdip_FillEllipse( G , Brush , 14 * ScaleFactor , 21 * ScaleFactor , 40 * ScaleFactor , 40 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillEllipse( G , Brush , 123 * ScaleFactor , 12 * ScaleFactor , 46 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF008000" ) , Gdip_TextToGraphics( G , "ON" , "s" This.Font_Size " Center vcenter c" Brush " x" -3 * ScaleFactor " y" 15 * ScaleFactor , This.Font , 100 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 118 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 71 * ScaleFactor , 12 * ScaleFactor , 50 * ScaleFactor , 50 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillRoundedRectangle( G , Brush , 89 * ScaleFactor , 12 * ScaleFactor , 60 * ScaleFactor , 50 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF0C0E0D" ) , Gdip_FillEllipse( G , Brush , 120 * ScaleFactor , 20 * ScaleFactor , 43 * ScaleFactor , 39 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF0C0E0D" ) , Gdip_FillEllipse( G , Brush , 76 * ScaleFactor , 20 * ScaleFactor , 43 * ScaleFactor , 39 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF0C0E0D" ) , Gdip_FillRoundedRectangle( G , Brush , 90 * ScaleFactor , 20 * ScaleFactor , 58 * ScaleFactor , 39 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 130 * ScaleFactor , 19 * ScaleFactor , 34 * ScaleFactor , 34 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillEllipse( G , Brush , 75 * ScaleFactor , 19 * ScaleFactor , 34 * ScaleFactor , 34 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF212221" ) , Gdip_FillRoundedRectangle( G , Brush , 90 * ScaleFactor , 19 * ScaleFactor , 60 * ScaleFactor , 34 * ScaleFactor , 5 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillPie( G , Brush , 77 * ScaleFactor , 14 * ScaleFactor , 85 * ScaleFactor , 27 * ScaleFactor , 0 , 180 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillPie( G , Brush , 126 * ScaleFactor , 19 * ScaleFactor , 36 * ScaleFactor , 19 * ScaleFactor , 0 , -90 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillRectangle( G , Brush , 93 * ScaleFactor , 19 * ScaleFactor , 54 * ScaleFactor , 10 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF474948" ) , Gdip_FillPie( G , Brush , 77 * ScaleFactor , 19 * ScaleFactor , 36 * ScaleFactor , 19 * ScaleFactor , 180 , 90 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G ),This.Switch_On_Bitmap:=Gdip_CreateHBITMAPFromBitmap(pBitmap),Gdip_DisposeImage(pBitmap)
}
Switch_States(){
GuiControl,% This.Window ":Focus",% This.Hwnd
(This.State=1)?(This.State:=0,This.Draw_Off()):(This.State:=1,This.Draw_On())
if(This.Label){
if(This.Function)
This.Function.Call()
else
gosub,% This.Label
}
}
Draw_Off(){
SetImage(This.Hwnd,This.Switch_Off_Bitmap)
}
Draw_On(){
SetImage(This.Hwnd,This.Switch_On_Bitmap)
}
}
;######################################################################################################################################
;##################################################### #######################################################
;##################################################### sec.Button #######################################################
;##################################################### #######################################################
;######################################################################################################################################
class Button{
__New( x := 10 , y := 10 , w := 150 , h := 40 , Window := "1", Text := "Button",Label := "" , Button_Color := "" , Button_Background_Color:= "" , Font := "Tahoma" , Font_Size := "16" , Font_Color_Top := "000000" , Font_Color_Bottom := "FFFFFF" ){
This.Text_Color_Top := "0xFF" Config[10] , This.Text_Color_Bottom := "0xFF000000" , This.Font := Config[9] , This.Font_Size := Config[11]
This.X := x , This.Y := y , This.W := w , This.H := h , This.Window := Window , This.Text := Text ,This.Label := Label, This.Button_Background_Color := "0xFF" Button_Background_Color , This.Button_Color := "0xFF" Button_Color
This.Create_Default_Bitmap() , This.Create_Hover_Bitmap() , This.Create_Pressed_Bitmap() , This.Create_Trigger()
sleep, 20
This.Draw_Default()
}
Create_Trigger(){
global
; num := Button.Length() + 1
Gui , % This.Window ": Add" , Picture , % "x" This.X " y" This.Y " w" This.W " h" This.H " hwndHwnd_" Num " v" Num " g" This.Label " 0xE"
This.Number := Num , This.Hwnd := Hwnd_%num%
}
Create_Default_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W, This.H )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF222222" )
Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 5 )
Gdip_DeleteBrush( Brush )
if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
else
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , This.Button_Color , "0xFF333333" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter c" Brush " x-1 y-1" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter c" Brush " x0 y0" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Default_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Hover_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W , This.H )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRoundedRectangle( G , Brush , 1 , -1 , This.W-2 , This.H+1 , Config[10] )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF222222" )
Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , Config[10] )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , Config[10] )
Gdip_DeleteBrush( Brush )
if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , "0xFF444444" , This.Button_Color , 1 , 1 )
else
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , This.Button_Color , "0xFF444444" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , Config[10] )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-1" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y0" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Hover_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Pressed_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W , This.H )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF222222" )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , 0 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-2" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y-1" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Pressed_Bitmap := Gdip_CreateHBITMAPFromBitmap( pBitmap )
Gdip_DisposeImage( pBitmap )
}
Draw_Default(){
SetImage( This.Hwnd , This.Default_Bitmap )
}
Draw_Hover(){
SetImage( This.Hwnd , This.Hover_Bitmap )
}
Draw_Pressed(){
SetImage( This.Hwnd , This.Pressed_Bitmap )
SetTimer , Hov_Hover , Off
While( GetKeyState( "LButton" ) )
sleep , 10
SetTimer , Hov_Hover , On
MouseGetPos,,,, ctrl , 2
if( This.Hwnd != ctrl ){
This.Draw_Default()
return False
}else {
This.Draw_Hover()
return true
}
}
}
;######################################################################################################################
;##################################################### ###################################
;##################################################### sec.Tabs ###################################
;##################################################### ###################################
;######################################################################################################################
tooltipOff:
ToolTip,
return
Tab_Label:
if(Tab.Tab=1){
Gui,1:Show
Gui,2:show,% "x0 y0 " Config[4] Config[5]
Gui,3:Hide
Gui,4:Hide
Gui,5:Hide
Gui,6:Hide
Gui,7:Hide
}else if(Tab.Tab=2){
Gui,1:Show
Gui,2:Hide
Gui,3:show,% "x0 y0 " Config[4] Config[5]
Gui,4:Hide
Gui,5:Hide
Gui,6:Hide
Gui,7:Hide
}else if(Tab.Tab=3){
Gui,1:Show
Gui,2:Hide
Gui,3:Hide
Gui,4:show,% "x0 y0 " Config[4] Config[5]
Gui,5:Hide
Gui,6:Hide
Gui,7:Hide
}else if(Tab.Tab=4){
Gui,1:Show
Gui,2:Hide
Gui,3:Hide
Gui,4:Hide
Gui,5:show,% "x0 y0 " Config[4] Config[5]
Gui,6:Hide
Gui,7:Hide
}else if(Tab.Tab=5){
Gui,1:Show
Gui,2:Hide
Gui,3:Hide
Gui,4:Hide
Gui,5:Hide
Gui,6:show,% "x0 y0 " Config[4] Config[5]
Gui,7:Hide
}else if(Tab.Tab=6){
Gui,1:Show
Gui,2:Hide
Gui,3:Hide
Gui,4:Hide
Gui,5:Hide
Gui,6:Hide
Gui,7:show,% "x0 y0 " Config[4] Config[5]
}
return
class 5Tab {
__New(x:=0, y:=0, window:="", label:="", Selected_Tab:="", Background_Color:=""){
This.X:=x
This.Y:=y
This.W:=508
This.H:=34
This.Window:=window
This.Label:=Label
This.Tab:=Selected_Tab
This.Background_Color:=""
This.Create_Trigger()
This.Create_Tab1_Bitmap()
This.Create_Tab2_Bitmap()
This.Create_Tab3_Bitmap()
This.Create_Tab4_Bitmap()
This.Create_Tab5_Bitmap()
This.Create_Tab6_Bitmap()
sleep 20
(This.Tab=1)?(SetImage(This.Hwnd,This.Tab1_Bitmap)):(This.Tab=2)?(SetImage(This.Hwnd,This.Tab2_Bitmap)):(This.Tab=3)?(SetImage(This.Hwnd,This.Tab3_Bitmap)):(This.Tab=4)?(SetImage(This.Hwnd,This.Tab4_Bitmap)):(This.Tab=5)?(SetImage(This.Hwnd,This.Tab5_Bitmap)):(This.Tab=6)?(SetImage(This.Hwnd,This.Tab6_Bitmap))
}
Create_Trigger(){
local hwnd
Gui,% This.Window ":Add",Picture,% "x" This.X " y" This.Y " w" This.W " h" This.H " hwndhwnd 0xE"
This.hwnd:=hwnd
Gui,% This.Window ":Add",Text,% "x" This.X+3 " y" This.Y+5 " w100 h30 BackgroundTrans hwndhwnd"
This.Tab1_Hwnd:=hwnd
Gui,% This.Window ":Add",Text,% "x" This.X+104 " y" This.Y+5 " w100 h30 BackgroundTrans hwndhwnd"
This.Tab2_Hwnd:=hwnd
Gui,% This.Window ":Add",Text,% "x" This.X+206 " y" This.Y+5 " w100 h30 BackgroundTrans hwndhwnd"
This.Tab3_Hwnd:=hwnd
Gui,% This.Window ":Add",Text,% "x" This.X+309 " y" This.Y+5 " w100 h30 BackgroundTrans hwndhwnd"
This.Tab4_Hwnd:=hwnd
Gui,% This.Window ":Add",Text,% "x" This.X+412 " y" This.Y+5 " w100 h30 BackgroundTrans hwndhwnd"
This.Tab5_Hwnd:=hwnd
Gui,% This.Window ":Add",Text,% "x" This.X+515 " y" This.Y+5 " w100 h30 BackgroundTrans hwndhwnd"
This.Tab6_Hwnd:=hwnd
TabBind:=This.Switch_Tab1.Bind(This)
GuiControl,% This.Window ":+G",% This.Tab1_Hwnd,% TabBind
TabBind:=This.Switch_Tab2.Bind(This)
GuiControl,% This.Window ":+G",% This.Tab2_Hwnd,% TabBind
TabBind:=This.Switch_Tab3.Bind(This)
GuiControl,% This.Window ":+G",% This.Tab3_Hwnd,% TabBind
TabBind:=This.Switch_Tab4.Bind(This)
GuiControl,% This.Window ":+G",% This.Tab4_Hwnd,% TabBind
TabBind:=This.Switch_Tab5.Bind(This)
GuiControl,% This.Window ":+G",% This.Tab5_Hwnd,% TabBind
TabBind:=This.Switch_Tab6.Bind(This)
GuiControl,% This.Window ":+G",% This.Tab6_Hwnd,% TabBind
if(This.Label)
(isFunc(This.Label))?(This.Function:=Func(This.Label))
}
Create_Tab1_Bitmap(){
pBitmap:=Gdip_CreateBitmap( 608 , 34 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRectangle( G , Brush , 0 , 0 , 608 , 34 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 103 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 204 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 305 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 406 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 507 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF" Config[1] , "0xFF" Config[1] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 2 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[1] , Config[14] " Center vCenter Italic Bold c" Brush " x0 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[2] , Config[14] " Center vCenter Italic c" Brush " x103 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[3] , Config[14] " Center vCenter Italic c" Brush " x204 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[4] , Config[14] " Center vCenter Italic c" Brush " x305 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[5] , Config[14] " Center vCenter Italic c" Brush " x406 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[6] , Config[14] " Center vCenter Italic c" Brush " x507 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Tab1_Bitmap:= Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Tab2_Bitmap(){
pBitmap:=Gdip_CreateBitmap( 608 , 34 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRectangle( G , Brush , 0 , 0 , 608 , 34 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 2 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 204 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 305 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 406 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 507 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF" Config[1] , "0xFF" Config[1] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 103 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[1] , Config[14] " Center vCenter Italic c" Brush " x0 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[2] , Config[14] " Center vCenter Bold Italic c" Brush " x103 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[3] , Config[14] " Center vCenter Italic c" Brush " x204 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[4] , Config[14] " Center vCenter Italic c" Brush " x305 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[5] , Config[14] " Center vCenter Italic c" Brush " x406 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[6] , Config[14] " Center vCenter Italic c" Brush " x507 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Tab2_Bitmap:= Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Tab3_Bitmap(){
pBitmap:=Gdip_CreateBitmap( 608 , 34 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRectangle( G , Brush , 0 , 0 , 608 , 34 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 2 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 103 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 305 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 406 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 507 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF" Config[1] , "0xFF" Config[1] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 204 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[1] , Config[14] " Center vCenter Italic c" Brush " x0 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[2] , Config[14] " Center vCenter Italic c" Brush " x103 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[3] , Config[14] " Center vCenter Bold Italic c" Brush " x204 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[4] , Config[14] " Center vCenter Italic c" Brush " x305 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[5] , Config[14] " Center vCenter Italic c" Brush " x406 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[6] , Config[14] " Center vCenter Italic c" Brush " x507 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Tab3_Bitmap:= Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Tab4_Bitmap(){
pBitmap:=Gdip_CreateBitmap( 608 , 34 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRectangle( G , Brush , 0 , 0 , 608 , 34 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 2 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 103 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 204 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 406 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 507 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF" Config[1] , "0xFF" Config[1] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 305 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[1] , Config[14] " Center vCenter Italic c" Brush " x0 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[2] , Config[14] " Center vCenter Italic c" Brush " x103 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[3] , Config[14] " Center vCenter Italic c" Brush " x204 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[4] , Config[14] " Center vCenter Bold Italic c" Brush " x305 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[5] , Config[14] " Center vCenter Italic c" Brush " x406 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[6] , Config[14] " Center vCenter Italic c" Brush " x507 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Tab4_Bitmap:= Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Tab5_Bitmap(){
pBitmap:=Gdip_CreateBitmap( 608 , 34 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRectangle( G , Brush , 0 , 0 , 608 , 34 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 2 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 103 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 204 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 305 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 507 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF" Config[1] , "0xFF" Config[1] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 406 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[1] , Config[14] " Center vCenter Italic c" Brush " x0 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[2] , Config[14] " Center vCenter Italic c" Brush " x103 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[3] , Config[14] " Center vCenter Italic c" Brush " x204 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[4] , Config[14] " Center vCenter Italic c" Brush " x305 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[5] , Config[14] " Center vCenter Bold Italic c" Brush " x406 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[6] , Config[14] " Center vCenter Italic c" Brush " x507 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Tab5_Bitmap:= Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Tab6_Bitmap(){
pBitmap:=Gdip_CreateBitmap( 608 , 34 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRectangle( G , Brush , 0 , 0 , 608 , 34 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 2 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 103 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 204 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 305 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 207 , 4 , 98 , 29 , "0xFF" Config[2] , "0xFF" Config[2] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 406 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF" Config[1] , "0xFF" Config[1] , 1 , 1 )
Gdip_FillRectangle( G , Brush , 507 , 2 , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[1] , Config[14] " Center vCenter Italic c" Brush " x0 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[2] , Config[14] " Center vCenter Italic c" Brush " x103 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[3] , Config[14] " Center vCenter Italic c" Brush " x204 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[4] , Config[14] " Center vCenter Italic c" Brush " x305 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[5] , Config[14] " Center vCenter Italic c" Brush " x406 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[13] )
Gdip_TextToGraphics( G , tabSet[6] , Config[14] " Center vCenter Bold Italic c" Brush " x507 y3" , Config[12] , 100 , 30 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Tab6_Bitmap:= Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Switch_Tab1(){
GuiControl,% This.Window ":Focus",% This.Hwnd
if(This.Tab!=1){
SetImage(This.Hwnd,This.Tab1_Bitmap)
This.Tab:=1
This.Sub_Redirect()
}
}
Switch_Tab2(){
GuiControl,% This.Window ":Focus",% This.Hwnd
if(This.Tab!=2){
SetImage(This.Hwnd,This.Tab2_Bitmap)
This.Tab:=2
This.Sub_Redirect()
}
}
Switch_Tab3(){
GuiControl,% This.Window ":Focus",% This.Hwnd
if(This.Tab!=3){
SetImage(This.Hwnd,This.Tab3_Bitmap)
This.Tab:=3
This.Sub_Redirect()
}
}
Switch_Tab4(){
GuiControl,% This.Window ":Focus",% This.Hwnd
if(This.Tab!=4){
SetImage(This.Hwnd,This.Tab4_Bitmap)
This.Tab:=4
This.Sub_Redirect()
}
}
Switch_Tab5(){
GuiControl,% This.Window ":Focus",% This.Hwnd
if(This.Tab!=5){
SetImage(This.Hwnd,This.Tab5_Bitmap)
This.Tab:=5
This.Sub_Redirect()
}
}
Switch_Tab6(){
GuiControl,% This.Window ":Focus",% This.Hwnd
if(This.Tab!=6){
SetImage(This.Hwnd,This.Tab6_Bitmap)
This.Tab:=6
This.Sub_Redirect()
}
}
Sub_Redirect(){
if(This.Function){
This.Function.Call()
}else if(This.Label){
gosub,% This.Label
}
}
}
;######################################################################################################################
;##################################################### ###################################
;##################################################### sec.custom gdip ###################################
;##################################################### ###################################
;######################################################################################################################
Gdip_Startup()
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
return pToken
}
Gdip_CreateBitmap(Width, Height, Format=0x26200A)
{
DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
Return pBitmap
}
Gdip_GraphicsFromImage(pBitmap)
{
DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
return pGraphics
}
Gdip_SetSmoothingMode(pGraphics, SmoothingMode)
{
return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", SmoothingMode)
}
Gdip_BrushCreateSolid(ARGB=0xff000000)
{
DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
return pBrush
}
Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillRectangle"
, Ptr, pGraphics
, Ptr, pBrush
, "float", x
, "float", y
, "float", w
, "float", h)
}
Gdip_DeleteBrush(pBrush)
{
return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt", pBrush)
}
Gdip_CreatePen(ARGB, w)
{
DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
return pPen
}
Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawRectangle", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
}
Gdip_DeletePen(pPen)
{
return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt", pPen)
}
Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0)
{
IWidth := Width, IHeight:= Height
RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
RegExMatch(Options, "i)NoWrap", NoWrap)
RegExMatch(Options, "i)R(\d)", Rendering)
RegExMatch(Options, "i)S(\d+)(p*)", Size)
if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
PassBrush := 1, pBrush := Colour2
if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
return -1
Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
Loop, Parse, Styles, |
{
if RegExMatch(Options, "\b" A_loopField)
Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
}
Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
Loop, Parse, Alignments, |
{
if RegExMatch(Options, "\b" A_loopField)
Align |= A_Index//2.1 ; 0|0|1|1|2|2
}
xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
if !PassBrush
Colour := "0x" (Colour2 ? Colour2 : "ff000000")
Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
hFamily := Gdip_FontFamilyCreate(Font)
hFont := Gdip_FontCreate(hFamily, Size, Style)
FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
hFormat := Gdip_StringFormatCreate(FormatStyle)
pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
if !(hFamily && hFont && hFormat && pBrush && pGraphics)
return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
CreateRectF(RC, xpos, ypos, Width, Height)
Gdip_SetStringFormatAlign(hFormat, Align)
Gdip_SetTextRenderingHint(pGraphics, Rendering)
ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
if vPos
{
StringSplit, ReturnRC, ReturnRC, |
if (vPos = "vCentre") || (vPos = "vCenter")
ypos += (Height-ReturnRC4)//2
else if (vPos = "Top") || (vPos = "Up")
ypos := 0
else if (vPos = "Bottom") || (vPos = "Down")
ypos := Height-ReturnRC4
CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
}
if !Measure
E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
if !PassBrush
Gdip_DeleteBrush(pBrush)
Gdip_DeleteStringFormat(hFormat)
Gdip_DeleteFont(hFont)
Gdip_DeleteFontFamily(hFamily)
return E ? E : ReturnRC
}
Gdip_DeleteGraphics(pGraphics)
{
return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff)
{
DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "uint*", hbm, "int", Background)
return hbm
}
SetImage(hwnd, hBitmap)
{
SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
E := ErrorLevel
DeleteObject(E)
return E
}
Gdip_DisposeImage(pBitmap)
{
return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt", pBitmap)
}
DeleteObject(hObject)
{
return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
}
Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillEllipse", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
}
Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1)
{
CreateRectF(RectF, x, y, w, h)
DllCall("gdiplus\GdipCreateLineBrushFromRect", A_PtrSize ? "UPtr" : "UInt", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
return LGpBrush
}
Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r)
{
Region := Gdip_GetClipRegion(pGraphics)
Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
Gdip_SetClipRegion(pGraphics, Region, 0)
Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
Gdip_SetClipRegion(pGraphics, Region, 0)
Gdip_DeleteRegion(Region)
return E
}
Gdip_FillPie(pGraphics, pBrush, x, y, w, h, StartAngle, SweepAngle)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillPie"
, Ptr, pGraphics
, Ptr, pBrush
, "float", x
, "float", y
, "float", w
, "float", h
, "float", StartAngle
, "float", SweepAngle)
}
Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r)
{
Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
Gdip_ResetClip(pGraphics)
Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
Gdip_ResetClip(pGraphics)
return E
}
Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawLine"
, Ptr, pGraphics
, Ptr, pPen
, "float", x1
, "float", y1
, "float", x2
, "float", y2)
}
Gdip_CloneBrush(pBrush)
{
DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt", pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
return pBrushClone
}
Gdip_FontFamilyCreate(Font)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if (!A_IsUnicode)
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, "uint", 0, "int", 0)
VarSetCapacity(wFont, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, Ptr, &wFont, "int", nSize)
}
DllCall("gdiplus\GdipCreateFontFamilyFromName"
, Ptr, A_IsUnicode ? &Font : &wFont
, "uint", 0
, A_PtrSize ? "UPtr*" : "UInt*", hFamily)
return hFamily
}
Gdip_FontCreate(hFamily, Size, Style=0)
{
DllCall("gdiplus\GdipCreateFont", A_PtrSize ? "UPtr" : "UInt", hFamily, "float", Size, "int", Style, "int", 0, A_PtrSize ? "UPtr*" : "UInt*", hFont)
return hFont
}
Gdip_StringFormatCreate(Format=0, Lang=0)
{
DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, A_PtrSize ? "UPtr*" : "UInt*", hFormat)
return hFormat
}
CreateRectF(ByRef RectF, x, y, w, h)
{
VarSetCapacity(RectF, 16)
NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
}
Gdip_SetStringFormatAlign(hFormat, Align)
{
return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" : "UInt", hFormat, "int", Align)
}
Gdip_SetTextRenderingHint(pGraphics, RenderingHint)
{
return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", RenderingHint)
}
Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
VarSetCapacity(RC, 16)
if !A_IsUnicode
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, "uint", 0, "int", 0)
VarSetCapacity(wString, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
}
DllCall("gdiplus\GdipMeasureString"
, Ptr, pGraphics
, Ptr, A_IsUnicode ? &sString : &wString
, "int", -1
, Ptr, hFont
, Ptr, &RectF
, Ptr, hFormat
, Ptr, &RC
, "uint*", Chars
, "uint*", Lines)
return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
}
Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if (!A_IsUnicode)
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, 0, "int", 0)
VarSetCapacity(wString, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
}
return DllCall("gdiplus\GdipDrawString"
, Ptr, pGraphics
, Ptr, A_IsUnicode ? &sString : &wString
, "int", -1
, Ptr, hFont
, Ptr, &RectF
, Ptr, hFormat
, Ptr, pBrush)
}
Gdip_DeleteStringFormat(hFormat)
{
return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" : "UInt", hFormat)
}
Gdip_DeleteFont(hFont)
{
return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt", hFont)
}
Gdip_DeleteFontFamily(hFamily)
{
return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" : "UInt", hFamily)
}
Gdip_GetClipRegion(pGraphics)
{
Region := Gdip_CreateRegion()
DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
return Region
}
Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0)
{
return DllCall("gdiplus\GdipSetClipRect", A_PtrSize ? "UPtr" : "UInt", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
}
Gdip_SetClipRegion(pGraphics, Region, CombineMode=0)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr, Region, "int", CombineMode)
}
Gdip_DeleteRegion(Region)
{
return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" : "UInt", Region)
}
Gdip_ResetClip(pGraphics)
{
return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawEllipse", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
}
Gdip_CreateRegion()
{
DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
return Region
}
Gdip_Shutdown(pToken)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
DllCall("gdiplus\GdiplusShutdown", Ptr, pToken)
if hModule := DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("FreeLibrary", Ptr, hModule)
return 0
}
Nice work Joe. I noticed that the text on the switch is a bit big ( "Off" in particular ).joekingcool wrote: ↑08 Nov 2023, 21:06@Hellbent
fantastic work as always!!! i was working on a basic gui using your controls to make it easier for people to make guis. but using your functions/controls. but now i need to revamp and try to use this in the gui. also i somehow over time lose the ability to show button pressed . well its a work in progress, i guess.
For sure, go right ahead.i hope its ok that i tweaked some functions to make it simplier for me to add controls.
Code: Select all
#Include <GDIP_ALL> ;GDIP: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=6517
#SingleInstance Force
Gdip_Startup()
Gui1 := New PopUpWindow_V3( "+AlwaysOnTop" , "Test Window" ,, { AutoShow: 1 , W: 380 , H: 320 , X: A_ScreenWidth - 410 , Y: 130 } )
Gui2 := New PopUpWindow_V3( "+Parent" Gui1.Hwnd ,"", 2 , { AutoShow: 1 , X:10 , Y:10 , W: 300 , H: 300 } )
Gui2.PaintBackground( "0xff22262a" )
Gui2.PaintBackground( { Color: "0x660077dd" , X: 12 , Y: 12 , W: Gui2.W - 24 , H: Gui2.H - 24 , Roundness: 40 } , 1 )
Gui2.Add( "Text" , "x0 y0 w" Gui2.W " h" Gui2.H ,,, "TestLabel2" )
Gui2.DrawBitmap( Gui2.CreateBitmapFromFile( "C:\Users\CivRe\OneDrive\Desktop\AHK Tools\Color Picker Mini\Screen Shots\20231013004430.png" ) , { X: 0 , Y: 0 , W: Gui2.W , H: Gui2.H } , dispose := 1 , autoUpdate := 1 )
Gui1.Add( "Button" ,,,, "TestLabel" )
Gui2.FillEllipse_Solid( color := "0x66FF0000" , { X: 0 , Y: 0 , W: 100 , H: 100 } ,,,, 1 )
Gui2.DrawText_Solid( "Hello World" , { X: 0 , Y: 0 , W: Gui2.W , H: Gui2.H } , { Size: 42 , Color: "0xFFFFFFFF" , Options: "Center vCenter" , Type: "Impact" } , offset := 0 , bottomColor := "0xFF000000" , 1 )
Gui2.PolygonShapes( { X: 100 , Y: 100 } , Color := "0xFF3399ff" , Radius := 33 , StartAngle := 0 , Sides := 12 , returnString := 1 , AddExtraWrapArm := 0 , ReturnWinSetRegion := 0 , AutoUpdate := 1 )
angle := 0
Sleep, 2000
Loop, 33 {
Gui2.ClearWindow()
Gui2.PolygonShapes( { X: 100 , Y: 100 } , Color := "0xFF3399ff" , Radius := 70 , StartAngle := angle+=35 , Sides := A_Index + 2 , returnString := 1 , AddExtraWrapArm := 0 , ReturnWinSetRegion := 0 , AutoUpdate := 1 )
sleep, 60
}
Gui2.DrawArrow( { X:0 , Y: 10 } , s := { X:11 , Y: 11 } , color := "0xFFFF0000" , borderColor := "0xFF000000" , ,,,, AutoUpdate := 1 )
Loop, 111 {
Gui2.ClearWindow()
s.X += .03
s.Y += 2
Gui2.DrawArrow( { X:0 , Y: 10 } ,s , color := "0xFF000000" , borderColor := "0xFF000000" , ,,,, AutoUpdate := 1 )
Sleep, 22
}
Gui2.DrawArrow( { X:0 , Y: 10 } ,s , color := "0xFFFF0000" , borderColor := "0xFF000000" , ,,,, AutoUpdate := 1 )
angle := 0
Sleep, 1000
Loop, 33 {
Gui2.ClearWindow()
Gui2.PolygonShapes( { X: 100 , Y: 100 } , Color := "0x990099ff" , Radius := 100 , StartAngle := 270 , Sides := A_Index + 2 , returnString := 1 , AddExtraWrapArm := 0 , ReturnWinSetRegion := 0 , AutoUpdate := 1 )
Gui2.PolygonShapes( { X: 100 , Y: 100 } , Color := "0xaa880000" , Radius := 70 , StartAngle := angle+=35 , Sides := A_Index + 2 , returnString := 1 , AddExtraWrapArm := 0 , ReturnWinSetRegion := 0 , AutoUpdate := 1 )
sleep, 122
}
Gui2.DrawArrow( { X:250 , Y: 210 } , s := { X:222 , Y: 11 } , color := "0xFFFF0000" , borderColor := "0xFF000000" , ,,,, AutoUpdate := 1 )
Loop, 140 {
s.X += .03
s.Y += 2
Gui2.DrawArrow( { X:250 , Y: 210 } ,s , color := "0x2322262a" , borderColor := "0xFF000000" , ,,,, AutoUpdate := 1 )
Sleep, 22
}
Gui2.DrawArrow( { X:250 , Y: 210 } ,s , color := "0xFF00FF00" , borderColor := "0xFF000000" , ,,,, AutoUpdate := 1 )
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
RALT::PopUpWindow_HelperClass.Helper()
TestLabel:
SoundBeep 999
TestLabel2:
SoundBeep
return
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_V3 extends PopUpWindow_LayeredWindowDrawingFunctions { ;class lvl = 6
;Date Started: Nov 9th, 2023
static MethodList := [ "New" , "Helper" , "DrawBitmap"
, "PaintBackground" , "DrawCachedBitmap" , "UpdateWindow"
, "ClearWindow" , "CreateWindowGraphics" , "DestroyWindowsGraphics"
, "CreateCachedBitmap" , "DisposeCachedbitmap" , "Add"
, "GetControlPosition" , "Show" , "Hide"
, "SetMargin" , "SetFont" , "SetColor"
, "SetPosition" , "UpdateDefaults" , "UpdateGraphics"
, "__Delete" , "SetControlList" , "Set"
, "Get" , "OwnsTips" , "CreateBitmapFromFile"
, "FillEllipse_Solid" , "DrawText_Solid" , "FillPolygon_Solid"
, "PolygonShapes" , "DrawArrow" ]
__New( options := "" , title := "" , type := "Normal" , defaultsObject := "" ){
This._SetDefaults()
This.UpdateDefaults( defaultsObject )
if( type = 2 || type = "Layered" || type = "L" || type = "LW" || type = "LayeredWindow" || type = "Layered Window" )
This.WindowType := "LayeredWindow"
else
This.WindowType := "NormalWindow"
This._CreateWindow( options , title )
This.SetFont()
This.SetMargin()
This.SetColor()
if( This.WindowType = "LayeredWindow" )
This.CreateWindowGraphics()
if( This.AutoShow )
This.Show()
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_HelperClass extends PopUpWindow_V3 {
Static SelectedMethod := 1 ;{
, SelectedListType := 1
, OutputName := "Gui1"
, Param1 := ""
, Param2 := ""
, Param3 := ""
, Param4 := ""
, Param5 := ""
, Param6 := ""
, Param7 := ""
, Param8 := ""
, Param9 := ""
;}
Helper(){
static cc , textWidth := 110
cc := PopUpWindow_HelperClass.HelperWindow := New PopUpWindow_V3( "+AlwaysOnTop ",,, {Color:"22262a" , ControlColor: "12161a" , FontColor: "FFFFFF" ,FontSize: 8 } )
cc.Add( "Text" , "xm ym w135 r1 " , "Window Object Name:" )
cc.Add( "Edit" , "x+m w135 r1 Center" , "Gui1" , "OutputNameEdit" )
cc.Add( "Radio" , "xm w135 r1 Group Checked" , "All Methods" )
cc.Add( "ListBox" , " xm w300 r20 AltSubmit Section" ,, "MethodListbox" , PopUpWindow_HelperClass._Helper_SetParams.Bind( PopUpWindow_HelperClass ) )
cc.Add( "Text" , "w690 Center 0x200 Border " , "Details" , "ExampleOutputText" )
cc.Add( "Edit" , "wp r6 -VScroll Disabled" , "Tips`nTips`nTips`nTips" , "DetailsEdit" )
cc.Add( "Button" , "wp r1 " , "Clipboard Method Call" , "ClipButton" , PopUpWindow_HelperClass._Helper_ClipboardMethodCall.Bind( PopUpWindow_HelperClass ) )
cc.Add( "Text" , "x" cc.Controls.MethodListbox.X + cc.Controls.MethodListbox.W + cc.MarginX " ys w" textWidth " Border Section " , "Param 1:" , "Param1Text" )
cc.Add( "Edit" , "x+m ys w260 " , "Param 1" , "Param1Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 2:" , "Param2Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 2" , "Param2Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 3:" , "Param3Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 3" , "Param3Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 4:" , "Param4Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 4" , "Param4Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 5:" , "Param5Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 5" , "Param5Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 6:" , "Param6Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 6" , "Param6Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 7:" , "Param7Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 7" , "Param7Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 8:" , "Param8Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 8" , "Param8Edit" )
cc.Add( "Text" , "xs w" textWidth " Border " , "Param 9:" , "Param9Text" )
cc.Add( "Edit" , "x+m w260 " , "Param 9" , "Param9Edit" )
cc.SetControlList( cc.Controls.MethodListbox , PopUpWindow_V3.MethodList , choose := 1 )
cc.SetFocus( cc.Controls.MethodListbox )
cc.Show( "AutoSize" )
This._Helper_SetParams()
}
_Helper_GetParams(){
static controlList := [ "OutputName" , "Param1" , "Param2" , "Param3" , "Param4" , "Param5" , "Param6" , "Param7" , "Param8" , "Param9" ]
for k , v in controlList
PopUpWindow_HelperClass[ v ] := PopUpWindow_HelperClass.HelperWindow.Get( PopUpWindow_HelperClass.HelperWindow.Controls[ v "Edit" ] )
}
_Helper_SetParams(){
local cc := PopUpWindow_HelperClass
local MethodLib := PopUpWindow_HelperClass._Helper_GetMethodMap()
local controlObject := PopUpWindow_HelperClass.HelperWindow.Controls.MethodListbox
local method := PopUpWindow_V3.MethodList[ PopUpWindow_HelperClass.HelperWindow.Get( controlObject ) ]
for k , v in [ "Param1" , "Param2" , "Param3" , "Param4" , "Param5" , "Param6" , "Param7" , "Param8" , "Param9" ] {
controlObject := PopUpWindow_HelperClass.HelperWindow.Controls[ "Param" A_Index "Edit" ]
PopUpWindow_HelperClass.HelperWindow.Set( controlObject , "-Disabled" )
PopUpWindow_HelperClass.HelperWindow.Set( controlObject ,, MethodLib[ method ][ "Default_Param" A_Index ] )
PopUpWindow_HelperClass[ v ] := MethodLib[ method ][ "Default_Param" A_Index ]
if( PopUpWindow_HelperClass[ v ] = "" )
PopUpWindow_HelperClass.HelperWindow.Set( controlObject , "+Disabled" )
controlObject := PopUpWindow_HelperClass.HelperWindow.Controls[ v "Text" ]
PopUpWindow_HelperClass.HelperWindow.Set( controlObject ,, MethodLib[ method ][ "Default_Param" A_Index "_Name" ] )
}
PopUpWindow_HelperClass[ "OutputName" ] := PopUpWindow_HelperClass.HelperWindow.Get( PopUpWindow_HelperClass.HelperWindow.Controls[ "OutputNameEdit" ] )
MethodLib := PopUpWindow_HelperClass._Helper_GetMethodMap()
controlObject := PopUpWindow_HelperClass.HelperWindow.Controls[ "ExampleOutputText" ]
PopUpWindow_HelperClass.HelperWindow.Set( controlObject ,, MethodLib[ method ][ "Output" ] )
}
_Helper_GetMethodMap(){
local cc := PopUpWindow_HelperClass
local index := 0
local MethodLib := {}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.New := { Default_Param1 : """+AlwaysOnTop""" , Default_Param1_Name : "Options"
, Default_Param2 : "WinTitle" , Default_Param2_Name : "Title"
, Default_Param3 : "NormalWindow" , Default_Param3_Name : "WindowType"
, Default_Param4 : "{ AutoShow: 1 , X: ""Center"" , Y: ""Center"" , W: A_ScreenWidth / 2 , H: A_ScreenHeight / 2 , Color: ""22262a"" }" , Default_Param4_Name : "DefaultsObject"
, Output : cc.OutputName " := New PopUpWindow_V3( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " , " cc.Param4 " )" }
;~ ;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.Helper := { Output : "PopUpWindow_HelperClass.Helper()" }
;~ ;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.DrawBitmap := { Default_Param1 : "pBitmap := """ , Default_Param1_Name : "pBitmap"
, Default_Param2 : "0" , Default_Param2_Name : "X_Position"
, Default_Param3 : "0" , Default_Param3_Name : "Y_Position"
, Default_Param4 : cc.OutputName ".W" , Default_Param4_Name : "W_Position"
, Default_Param5 : cc.OutputName ".H" , Default_Param5_Name : "H_Position"
, Default_Param6 : false , Default_Param6_Name : "DisposeBitmap"
, Default_Param7 : false , Default_Param7_Name : "AutoUpdate"
, Output : cc.OutputName ".DrawBitmap( " cc.Param1 " , { X: " cc.Param2 " , Y: " cc.Param3 " , W: " cc.Param4 " , H: " cc.Param5 " } , dispose := " cc.Param6 " , autoUpdate := " cc.Param7 " )" }
;~ ;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.PaintBackground := { "Default_Param" ( index := 1 ) : "0xFF000000" , "Default_Param" index "_Name" : "Color"
, "Default_Param" ++index : false , "Default_Param" index "_Name" : "AutoUpdate"
, Output : cc.OutputName ".PaintBackground( BGColor := " cc.param1 " , AutoUpdate := " cc.Param2 " ) `;{ Color: " cc.Param1 " , X: 2 , Y: 2 , W: " cc.OutputName ".W - 4 , H: " cc.OutputName ".H - 4 , Roundness: 10 }" }
;~ ;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.DrawCachedBitmap := { "Default_Param" ( index := 1 ) : false , "Default_Param" index "_Name" : "AutoUpdate"
, Output : cc.OutputName ".DrawCachedBitmap( autoUpdate := " cc.Param1 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.UpdateWindow := { "Default_Param" ( index := 1 ) : "255" , "Default_Param" index "_Name" : "Alpha"
, Output : cc.OutputName ".UpdateWindow( alpha := " cc.Param1 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.ClearWindow := { "Default_Param" ( index := 1 ) : false , "Default_Param" index "_Name" : "AutoUpdate"
, Output : cc.OutputName ".ClearWindow( autoUpdate := " cc.Param1 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.CreateWindowGraphics := { Output : cc.OutputName ".CreateWindowGraphics()" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.DestroyWindowsGraphics:= { Output : cc.OutputName ".DestroyWindowsGraphics()" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.CreateCachedBitmap := { "Default_Param" ( index := 1 ) : "pBitmap" , "Default_Param" index "_Name" : "pBitmap"
, "Default_Param" ++index : false , "Default_Param" index "_Name" : "Dispose"
, Output : cc.OutputName ".CreateCachedBitmap( " cc.Param1 " , Dispose := " cc.Param2 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.DisposeCachedbitmap := { Output : cc.OutputName ".DisposeCachedbitmap()" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.Add := { "Default_Param" ( index := 1 ) : "controlType := ""Button""" , "Default_Param" index "_Name" : "ControlType"
, "Default_Param" ++index : "options := """"" , "Default_Param" index "_Name" : "Options"
, "Default_Param" ++index : "displayValue := """"" , "Default_Param" index "_Name" : "DisplayValue"
, "Default_Param" ++index : "controlName := """"" , "Default_Param" index "_Name" : "ControlName"
, "Default_Param" ++index : "label := """"" , "Default_Param" index "_Name" : "Label"
, "Default_Param" ++index : "rows := """"" , "Default_Param" index "_Name" : "Rows"
, Output : cc.OutputName ".Add( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " , " cc.Param4 " , " cc.Param5 " , " cc.Param6 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.GetControlPosition := { "Default_Param" ( index := 1 ) : "controlObject" , "Default_Param" index "_Name" : "ControlObject"
, Output : cc.OutputName ".GetControlPosition( " cc.Param1 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.Show := { "Default_Param" ( index := 1 ) : "options := """"" , "Default_Param" index "_Name" : "Options"
, "Default_Param" ++index : "title := """"" , "Default_Param" index "_Name" : "Title"
, "Default_Param" ++index : "transparency := 255" , "Default_Param" index "_Name" : "Transparency"
, Output : cc.OutputName ".Show( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.Hide := { Output : cc.OutputName ".Hide()" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.SetMargin := { "Default_Param" ( index := 1 ) : 10 , "Default_Param" index "_Name" : "MarginX"
, "Default_Param" ++index : 10 , "Default_Param" index "_Name" : "MarginY"
, Output : cc.OutputName ".SetMargin( " cc.Param1 " , " cc.Param2 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.SetFont := { "Default_Param" ( index := 1 ) : "type := """"" , "Default_Param" index "_Name" : "Type"
, "Default_Param" ++index : "size := """"" , "Default_Param" index "_Name" : "Size"
, "Default_Param" ++index : "color := """"" , "Default_Param" index "_Name" : "Color"
, "Default_Param" ++index : "options := """"" , "Default_Param" index "_Name" : "Options"
, Output : cc.OutputName ".SetFont( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " , " cc.Param4 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.SetColor := { "Default_Param" ( index := 1 ) : "color := ""22262A""" , "Default_Param" index "_Name" : "Color"
, "Default_Param" ++index : "controlColor := ""12161A""" , "Default_Param" index "_Name" : "ControlColor"
, Output : cc.OutputName ".SetColor( " cc.Param1 " , " cc.Param2 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.SetPosition := { "Default_Param" ( index := 1 ) : "x_or_Rectobj := """"" , "Default_Param" index "_Name" : "X_Or_RectObject"
, "Default_Param" ++index : "y := """"" , "Default_Param" index "_Name" : "Y"
, "Default_Param" ++index : "w := """"" , "Default_Param" index "_Name" : "W"
, "Default_Param" ++index : "h := """"" , "Default_Param" index "_Name" : "H"
, Output : cc.OutputName ".SetPosition( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " , " cc.Param4 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.UpdateDefaults := { "Default_Param" ( index := 1 ) : "defaultsObject" , "Default_Param" index "_Name" : "DefaultsObject"
, Output : cc.OutputName ".UpdateDefaults( " cc.Param1 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.UpdateGraphics := { Output : cc.OutputName ".UpdateGraphics()" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.__Delete := { Output : cc.OutputName " := """"" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.SetControlList := { "Default_Param" ( index := 1 ) : "controlObject" , "Default_Param" index "_Name" : "ControlObject"
, "Default_Param" ++index : "list := """"" , "Default_Param" index "_Name" : "List"
, "Default_Param" ++index : "choose := """"" , "Default_Param" index "_Name" : "Choose"
, Output : cc.OutputName ".SetControlList( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.Set := { "Default_Param" ( index := 1 ) : "controlObject" , "Default_Param" index "_Name" : "ControlObject"
, "Default_Param" ++index : "subCommand := """"" , "Default_Param" index "_Name" : "SubCommand"
, "Default_Param" ++index : "value := """"" , "Default_Param" index "_Name" : "Value"
, Output : cc.OutputName ".Set( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.Get := { "Default_Param" ( index := 1 ) : "controlObject" , "Default_Param" index "_Name" : "ControlObject"
, "Default_Param" ++index : "subCommand := """"" , "Default_Param" index "_Name" : "SubCommand"
, Output : cc.OutputName ".SetColor( " cc.Param1 " , " cc.Param2 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.OwnsTips := { Output : cc.OutputName ".OwnsTips()" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.CreateBitmapFromFile := { "Default_Param" ( index := 1 ) : "path := """"" , "Default_Param" index "_Name" : "ImageFilePath"
, Output : cc.OutputName ".CreateBitmapFromFile( """ cc.Param1 """ )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.DrawText_Solid := { "Default_Param" ( index := 1 ) : """SampleText""" , "Default_Param" index "_Name" : "Text"
, "Default_Param" ++index : "rectObject" , "Default_Param" index "_Name" : "RectObject"
, "Default_Param" ++index : "fontObject := """"" , "Default_Param" index "_Name" : "FontObject"
, "Default_Param" ++index : "offset := 0" , "Default_Param" index "_Name" : "Offset"
, "Default_Param" ++index : "bottomColor := ""0xFF000000""" , "Default_Param" index "_Name" : "BottomColor"
, "Default_Param" ++index : "AutoUpdate := 0" , "Default_Param" index "_Name" : "AutoUpdate"
, Output : cc.OutputName ".DrawText_Solid( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " , " cc.Param4 " , " cc.Param5 " , " cc.Param6 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.FillEllipse_Solid := { "Default_Param" ( index := 1 ) : "Color := ""0xFFFF0000""" , "Default_Param" index "_Name" : "Color"
, "Default_Param" ++index : "x_Or_RectObject := 0" , "Default_Param" index "_Name" : "x_Or_RectObject"
, "Default_Param" ++index : "y := 0" , "Default_Param" index "_Name" : "Y_Position"
, "Default_Param" ++index : "w := 10" , "Default_Param" index "_Name" : "Width"
, "Default_Param" ++index : "h := 10" , "Default_Param" index "_Name" : "Height"
, "Default_Param" ++index : "AutoUpdate := 0" , "Default_Param" index "_Name" : "AutoUpdate"
, Output : cc.OutputName ".FillEllipse_Solid( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " , " cc.Param4 " , " cc.Param5 " , " cc.Param6 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.FillPolygon_Solid := { "Default_Param" ( index := 1 ) : "Points := ""50 , 50 | 100 , 100 | 150 , 50 | 50 , 50 """ , "Default_Param" index "_Name" : "Points"
, "Default_Param" ++index : "color := ""0xFF000000""" , "Default_Param" index "_Name" : "Color"
, Output : cc.OutputName ".FillPolygon_Solid( " cc.Param1 " , " cc.Param2 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
MethodLib.PolygonShapes := { "Default_Param" ( index := 1 ) : "homeVector := { X: 10 , Y: 10 }" , "Default_Param" index "_Name" : "HomeVector"
, "Default_Param" ++index : "color := ""0xFF000000""" , "Default_Param" index "_Name" : "Color"
, "Default_Param" ++index : "radius := 100" , "Default_Param" index "_Name" : "Radius"
, "Default_Param" ++index : "startAngle := 0" , "Default_Param" index "_Name" : "StartAngle"
, "Default_Param" ++index : "sides := 4" , "Default_Param" index "_Name" : "Sides"
, "Default_Param" ++index : "returnString := 1" , "Default_Param" index "_Name" : "ReturnString"
, "Default_Param" ++index : "addExtraWrapArm := 1" , "Default_Param" index "_Name" : "AddExtraWrapArm"
, "Default_Param" ++index : "returnWinSetRegion := 0" , "Default_Param" index "_Name" : "ReturnWinSetRegion"
, "Default_Param" ++index : "autoUpdate := 0" , "Default_Param" index "_Name" : "AutoUpdate"
, Output : cc.OutputName ".PolygonShapes( " cc.Param1 " , " cc.Param2 " , " cc.Param3 " , " cc.Param4 " , " cc.Param5 " , " cc.Param6 " , " cc.Param7 " , " cc.Param8 " , " cc.Param9 " )" }
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
return MethodLib
}
_Helper_ClipboardMethodCall( ){
local MethodLib
local controlObject
local method
controlObject := PopUpWindow_HelperClass.HelperWindow.Controls.MethodListbox
method := PopUpWindow_V3.MethodList[ PopUpWindow_HelperClass.HelperWindow.Get( controlObject ) ]
PopUpWindow_HelperClass._Helper_GetParams()
MethodLib := PopUpWindow_HelperClass._Helper_GetMethodMap()
PopUpWindow_HelperClass.HelperWindow.OwnsTips()
Clipboard := MethodLib[ method ][ "Output" ]
ToolTip, added to clipboard
Sleep, 1000
ToolTip
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_LayeredWindowDrawingFunctions extends PopUpWindow_LayeredWindowMethods {
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
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()
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
if( isObject( color ) ){
Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) )
if( color.Haskey( "Roundness" ) )
Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Roundness )
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()
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
DrawCachedBitmap( AutoUpdate := 0 ){
DllCall( "gdiplus\GdipDrawCachedBitmap" , "Ptr" , this.G , "Ptr" , This.CachedBitmap , "Int" , 0 , "Int" , 0 )
if( AutoUpdate )
This.UpdateWindow()
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
CreateBitmapFromFile( path ){
return Gdip_CreateBitmapFromFile( path )
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
FillEllipse_Solid( color := "0xFFFF0000" , x_Or_RectObject := 0 , y := 0 , w := 10 , h := 10 , autoUpdate := 0 ){
local Brush := This._CreateBrush_Solid( color )
local rectObject := {}
if( IsObject( x_Or_RectObject ) )
rectObject := x_Or_RectObject
else
rectObject := { X: x_Or_RectObject , Y: y , W: w , H: h }
This._FillEllipse( Brush , rectObject )
This._DeleteBrush( Brush )
if( autoUpdate )
This.UpdateWindow()
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
_CreateBrush_Solid( color := "0xFFFF0000" ){
return Gdip_BrushCreateSolid( color )
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
_DeleteBrush( pBrush ){
Gdip_DeleteBrush( pBrush )
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
_FillEllipse( pBrush , rect ){
Gdip_FillEllipse( This.G , pBrush , rect.X , rect.Y , rect.W , rect.H )
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
DrawText_Solid( text , rectObject , fontObject := "" , offset := 0 , bottomColor := "0xFF000000" , autoUpdate := 0 ){
static fObj := { Type: "Arial" , Size: 10 , Color: "0xFF000000" , Options: "" }
local Brush
local k , v
for k , v in FontObject
fObj[ k ] := v
if( offset != 0 ){
Brush := This._CreateBrush_Solid( bottomColor )
This._TextToGraphics( text , rectObject , fObj , Brush , offset )
This._DeleteBrush( Brush )
}
Brush := This._CreateBrush_Solid( fObj.Color )
This._TextToGraphics( text , rectObject , fObj , Brush )
This._DeleteBrush( Brush )
if( autoUpdate )
This.UpdateWindow()
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
_TextToGraphics( text , rectObject , fObj , pBrush , offset := 0 , Measure := 0 ){
local options := "c" pBrush " s" fObj.Size " " fObj.Options " x" rectObject.X " y" rectObject.Y
Gdip_TextToGraphics( This.G , text , options , fObj.Type , rectObject.W , rectObject.H , Measure )
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
FillPolygon_Solid( Points := "50 , 50 | 100 , 100 | 150 , 50 | 50 , 50 " , Color := "0xFFFF0000" ){
local Brush := This._CreateBrush_Solid( color )
This._FillPolygon( Brush , points )
This._DeleteBrush( Brush )
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
_FillPolygon( pBrush , points ){
Gdip_FillPolygon( This.G , pBrush , Points )
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
PolygonShapes( HomeVector , Color := "0xFF000000" , Radius := 100 , StartAngle := 0 , Sides := 4 , returnString := 1 , AddExtraWrapArm := 0 , ReturnWinSetRegion := 0 , AutoUpdate := 0 ){
local outputShapeString := This._PolygonShapes( HomeVector , Radius , StartAngle , Sides , returnString , AddExtraWrapArm , ReturnWinSetRegion )
This.FillPolygon_Solid( outputShapeString , Color )
;~ MsgBox, % outputShapeString
if( Autoupdate )
This.UpdateWindow()
}
DrawArrow( StartVector , EndVector , color := "0xFFFF0000" , borderColor := "0xFF000000" , HeadLength := 25 , NeckLength := 2 , ArmLength := 12 , ElbowLength := 4 , AutoUpdate := 0 ){
local ArrowPoints
ArrowPoints := New ArrowHead_2( StartVector , EndVector , HeadLength , NeckLength , ArmLength , ElbowLength )
This.FillPolygon_Solid( ArrowPoints , color )
if( Autoupdate )
This.UpdateWindow()
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
_PolygonShapes( HomeVector , Radius := 100 , StartAngle := 0 , Sides := 4 , returnString := 1 , AddExtraWrapArm := 0 , ReturnWinSetRegion := 0 ){
local StartVector , points , SpacingAngle , OutputString
if( sides < 3 ){
MsgBox, 262192, Error , A shape requires 3 or more sides.`nWhat you're thinking of is a line or a point.
return
}
StartVector := New Vector( HomeVector )
StartVector.SetMag( Radius )
StartVector.SetAngle( StartAngle )
SpacingAngle := 360 / Sides
Points := []
Points[ 1 ] := New Vector( StartVector )
Points[ 1 ].Add( HomeVector )
if( returnString )
OutputString := Points[ 1 ].X "," Points[ 1 ].Y "|"
Loop, % Sides - 1 {
StartVector.RotateAngle( SpacingAngle )
Points[ A_Index + 1 ] := New Vector( StartVector )
Points[ A_Index + 1 ].Add( HomeVector )
if( returnString )
OutputString .= Points[ A_Index + 1 ].X "," Points[ A_Index + 1 ].Y "|"
}
if( returnString ){
OutputString .= Points[ 1 ].X "," Points[ 1 ].Y "|"
if( AddExtraWrapArm ) ;Adds an extra overlap so that when you use "DrawLines" the shape fully closes regardless of the thickness of the lines.
OutputString .= Points[ 2 ].X "," Points[ 2 ].Y "|"
if( ReturnWinSetRegion ){
OutputString := strReplace( OutputString , "," , "-" )
OutputString := strReplace( OutputString , "|" , " " )
}
return OutputString
}
return Points
}
;;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_LayeredWindowMethods extends PopUpWindow_Controls {
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()
}
CreateWindowGraphics(){
if( This.hbm ){
This.DestroyWindowsGraphics()
}
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 )
Gdip_SetInterpolationMode( This.G , This.InterpolationMode )
}
DestroyWindowsGraphics(){
Gdip_DeleteGraphics( This.G )
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
}
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 )
}
DisposeCachedbitmap(){
DllCall( "gdiplus\GdipDeleteCachedBitmap" , "Ptr" , This.CachedBitmap )
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_Events extends PopUpWindow_Controls { ;class lvl = 5
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_Controls extends PopUpWindow_Windows { ;class lvl = 4
Add( controlType := "Button" , options := "" , displayValue := "" , controlName := "" , label := "" , rows := "" ){
local hwnd , cc
if( label && !isObject( label ) )
Gui, % This.Hwnd ":Add", % controlType , % options " +hwndhwnd g" label , % displayValue
else
Gui, % This.Hwnd ":Add", % controlType , % options " +hwndhwnd " , % displayValue
if( isObject( label ) )
GuiControl, % This.Hwnd ":+g", % hwnd , % label
if( controlName = "" )
controlName := hwnd
This.Controls[ controlName ] := {}
cc := This.Controls[ controlName ]
This.ControlArray.Push( cc )
This.ControlHandles[ hwnd ] := cc
cc.Hwnd := hwnd
cc.Name := controlName
cc.Label := label
cc.Type := controlType
cc.DisplayValue := displayValue
cc.Options := options
cc.Index := This.ControlArray.Length()
if( rows )
cc.Rows := rows
cc.FontType := This.FontType
cc.FontSize := This.FontSize
cc.FontColor := This.FontColor
cc.FontOptions := This.FontOptions
This.GetControlPosition( cc )
cc.Tip := ""
}
GetControlPosition( controlObject ){
GuiControlGet, pos , % This.Hwnd ":pos" , % controlObject.Hwnd
controlObject.X := PosX
controlObject.Y := PosY
controlObject.W := PosW
controlObject.H := PosH
}
SetControlList( controlObject , list := "" , choose := "" ){
local string := ""
if( isObject( list ) ){
for k , v in list
string .= v "|"
GuiControl, % This.Hwnd ":" , % controlObject.Hwnd , % "|" string
}else{
GuiControl, % This.Hwnd ":" , % controlObject.Hwnd , % "|" list
}
if( choose )
GuiControl, % This.Hwnd ":Choose" , % controlObject.Hwnd , % choose
}
Choose( controlObject , choice := 1 ){
GuiControl, % This.Hwnd ":Choose" , % controlObject.Hwnd , % choice
}
SetFocus( controlObject ){
GuiControl, % This.Hwnd ":Focus" , % controlObject.Hwnd
}
Get( controlObject , subCommand := "" ){
local outVar
GuiControlGet, outVar , % This.Hwnd ":" subCommand , % controlObject.Hwnd
return outVar
}
Set( controlObject , subCommand := "" , value := "" ){
GuiControl, % This.Hwnd ":" subCommand , % controlObject.Hwnd , % value
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_Windows extends PopUpWindow_Settings { ;class lvl = 3
Show( options := "" , title := "" , transparency := "" ){
if( title != "" )
This.Title := title
if( options != "" ){
if( instr( "winSize" , options ) ){
options := strReplace( options , "winSize" )
Gui, % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " " options , % This.Title
}else{
Gui, % This.Hwnd ":Show", % options , % This.Title
}
}else{
Gui, % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H , % This.Title
}
This.IsVisable := 1
}
Hide(){
Gui, % This.Hwnd ":Hide"
This.IsVisable := 0
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_Settings extends PopUpWindow_BaseMethods { ;class lvl = 2
SetMargin( x := "" , y := "" ){
if( x != "" )
This.MarginX := x
if( y != "" )
This.MarginY := y
Gui, % This.Hwnd ":Margin", % This.MarginX , % This.MarginY
}
SetFont( type := "" , size := "" , color := "" , options := "" ){
if( type != "" )
This.FontType := type
if( size != "" )
This.FontSize := size
if( color != "" )
This.FontColor := color
if( options != "" )
This.FontOptions := options
Gui, % This.Hwnd ":Font", % "norm s" This.FontSize " c" This.FontColor " " This.FontOptions , % This.FontType
}
SetColor( color := "" , controlColor := "" ){
if( color != "" )
This.Color := color
if( controlColor != "" )
This.ControlColor := controlColor
Gui, % This.Hwnd ":Color", % This.Color , % This.ControlColor
}
SetPosition( x_or_Rect := "" , y := "" , w := "" , h := "" ){
if( isObject( x_or_Rect ) ){
for k , v in [ "X" , "Y" , "W" , "H" ] {
if( x_or_Rect[ k ] != "" )
This[ k ] := x_or_Rect[ k ]
}
}else{
if( w != "" )
This.W := w
if( h != "" )
This.H := h
if( x != "" ){
if( x = "Center" )
This.X := ( A_ScreenWidth - This.W ) / 2
else
This.X := x
}
if( Y != "" ){
if( Y = "Center" )
This.Y := ( A_ScreenHeight - This.H ) / 2
else
This.Y := Y
}
}
}
OwnsTips(){
Gui, % This.Hwnd ":+OwnDialogs"
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class PopUpWindow_BaseMethods { ;class lvl = 1
_SetDefaults(){
This.Hwnd := ""
This.Label := ""
This.Title := ""
This.Name := ""
This.X := "Center"
This.Y := "Center"
This.W := 300
This.H := 300
This.Color := ""
This.ControlColor := ""
This.FontColor := "000000"
This.FontSize := 9
This.FontType := "Arial"
This.FontOptions := ""
This.Controls := {}
This.ControlArray := []
This.ControlHandles := []
This.isVisable := 0
This.Transparency := 255
This.MarginX := 10
This.MarginY := 10
This.MinWidth := ""
This.MaxWidth := ""
This.MinHeight := ""
This.MaxHeight := ""
This.Smoothing := 2
This.InterpolationMode := 7
This.AutoShow := 0
}
UpdateDefaults( defaultsObject ){
local changeFont , changeColor , changeMargin
for k , v in defaultsObject
This[ k ] := defaultsObject[ k ]
if( This.X = "Center" )
This.X := ( A_ScreenWidth - This.W ) / 2
if( This.Y = "Center" )
This.Y := ( A_ScreenHeight - This.H ) / 2
}
UpdateGraphics(){
This.CreateWindowGraphics()
}
_CreateWindow( options := "" , title := "" ){
local hwnd
if( title != "" )
This.Title := title
if( This.WindowType = "LayeredWindow" ){
Gui, New, % " +hwndhwnd +E0x80000 -Caption -DPIScale " options , % This.Title
}else{
Gui, New, % " +hwndhwnd " options , % This.Title
}
This.Hwnd := hwnd
}
__Delete(){
Try
Gui, % This.Hwnd ":Destroy"
if( This.WindowType = "LayeredWindow" )
This.DestroyWindowsGraphics()
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
class ArrowHead_2 {
__New( Start , End , HeadLength := 30 , NeckLength := 10 , ArmLength := 30 , ElbowLength := 15 ){
Master := This._NewVector( Start )
This._SubVector( Master , End )
Head := This._NewVector( Master )
This._SetVectorMag( Head , HeadLength )
This._AddVector( Head , End )
Neck := This._NewVector( Master )
This._SetVectorMag( Neck , NeckLength )
This._AddVector( Neck , Head )
RightArm := This._NewVector( Master , , 1 )
This._SetVectorMag( RightArm , ArmLength )
This._AddVector( RightArm , Neck )
RightElbow := This._NewVector( Master , , 1 )
This._SetVectorMag( RightElbow , ElbowLength )
This._AddVector( RightElbow , Head )
LeftArm := This._NewVector( Master , , 2 )
This._SetVectorMag( LeftArm , ArmLength )
This._AddVector( LeftArm , Neck )
LeftElbow := This._NewVector( Master , , 2 )
This._SetVectorMag( LeftElbow , ElbowLength )
This._AddVector( LeftElbow , Head )
OutputString := ""
for k , v in [ "Start" , "RightElbow" , "RightArm" , "End" , "LeftArm" , "LeftElbow" , "Start" ]
OutputString .= %v%.X "," %v%.Y "|"
return OutputString
}
_NewVector( x , y := "" , rotate := 0 ){
if( IsObject( x ) ){
if( !rotate )
return { X: x.X , Y: x.Y }
else if( rotate = 1 )
return { X: x.Y * -1 , Y: x.X }
else if( rotate = 2 )
return { X: x.Y , Y: x.X * -1 }
}else{
if( !rotate )
return { X: x , Y: x }
else if( rotate = 1 )
return { X: y * -1 , Y: x }
else if( rotate = 2 )
return { X: y , Y: x * -1 }
}
}
_SubVector( vector1 , vector2 ){
vector1.X -= vector2.X
vector1.Y -= vector2.Y
}
_AddVector( vector1 , vector2 ){
vector1.X += vector2.X
vector1.Y += vector2.Y
}
_SetVectorMag( vector , mag ){
local m := This._GetVectorMag( vector )
vector.X := vector.X * mag / m
vector.Y := vector.Y * mag / m
}
_GetVectorMag( vector ){
return Sqrt( vector.X * vector.X + vector.Y * vector.Y )
}
}
;;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|;|<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>||<<<---(0)_(0)--->>>|
;************
;Vector Class
;**************************************************************************************************************************************************************************
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;**************************************************************************************************************************************************************************
Class Vector {
;Written By: HB
;Date: Sept 23rd, 2022
;Last Edit: Sept 24th, 2022
;Purpose: Vector math class
;Credit: Rohwedder
;Resources:
;Line intercept concepts and code: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=37175
;Create an Arrow: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92039&p=479129#p478944
;Getting an angle: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=108760&p=483661#p483678
;Setting an Angle: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=108760&p=483786#p483811
;
static RadToDeg := 45 / ATan( 1 )
, DegToRad := ATan( 1 ) / 45
__New( x := 0 , y := 0 , rotate := 0 ){
if( IsObject( x ) ){
if( rotate = 3 ){
This.X := x.X * -1
,This.Y := x.Y * -1
}else if( rotate = 2 ){
This.X := x.Y
,This.Y := x.X * -1
}else if( rotate = 1 ){
This.X := x.Y * -1
,This.Y := x.X
}else{
This.X := x.X
,This.Y := x.Y
}
}else{
if( rotate = 3 ){
This.X := X * -1
,This.Y := Y * -1
}else if( rotate = 2 ){
This.X := Y
,This.Y := X * -1
}else if( rotate = 1 ){
This.X := Y * -1
,This.Y := X
}else{
This.X := X
,This.Y := Y
}
}
}
Add( x , y := "" ){
if( IsObject( x ) ){
This.X += x.X
,This.Y += x.Y
}else if( y = "" ){
This.X += x
,This.Y += x
}else{
This.X += x
,This.Y += y
}
}
Sub( x , y := "" ){
if( IsObject( x ) ){
This.X -= x.X
,This.Y -= x.Y
}else if( y = "" ){
This.X -= X
,This.Y -= X
}else{
This.X -= X
,This.Y -= Y
}
}
Div( x , y := "" ){
if( IsObject( x ) ){
This.X /= x.X
,This.Y /= x.Y
}else if( x && y = "" ){
This.X /= x
,This.Y /= x
}else{
This.X /= X
,This.Y /= Y
}
}
Mult( x , y := "" ){
if( IsObject( x ) ){
This.X *= x.X
,This.Y *= x.Y
}else if( x && y = "" ){
This.X *= x
,This.Y *= x
}else{
This.X *= X
,This.Y *= Y
}
}
Dist( x , y := "" ){
if( IsObject( x ) )
return Sqrt( ( ( This.X - x.X ) **2 ) + ( ( This.Y - x.Y ) **2 ) )
else
return Sqrt( ( ( This.X - X ) **2 ) + ( ( This.Y - Y ) **2 ) )
}
GetMag(){
return Sqrt( This.X * This.X + This.Y * This.Y )
}
SetMag( magnitude ){
local m := This.GetMag()
This.X := This.X * magnitude / m
,This.Y := This.Y * magnitude / m
}
MagSq(){
return This.GetMag()**2
}
Dot( x , y := "" ){
if( IsObject( x ) )
return ( This.X * x.X ) + ( This.Y * x.Y )
else
return ( This.X * X ) + ( This.Y * Y )
}
Cross( x , y := "" ){
if( IsObject( x ) )
return This.X * x.Y - This.Y * x.X
else
return This.X * Y - This.Y * X
}
Norm(){
local m := This.GetMag()
This.X /= m
This.Y /= m
}
GetAngle(){
local angle
( ( angle := Vector.RadToDeg * DllCall( "msvcrt\atan2" , "Double" , This.Y , "Double" , This.X , "CDECL Double" ) ) < 0 ) ? ( angle += 360 )
return angle
}
SetAngle( newAngle := 0 , NewVector := 0 ){
local Angle := This.GetAngle()
, ChangeAngle := newAngle - Angle
, Co := Cos( Vector.DegToRad * ChangeAngle )
, Si := Sin( Vector.DegToRad * ChangeAngle )
, X := This.X
, Y := This.Y
, X2 := X * Co - Y * Si
, Y2 := X * Si + Y * Co
if( !NewVector )
This.X := X2 , This.Y := Y2
else
return New Vector( X2 , Y2 )
}
RotateAngle( rotationAmount := 90 , NewVector := 0 ){
local Co := Cos( Vector.DegToRad * rotationAmount )
, Si := Sin( Vector.DegToRad * rotationAmount )
, X := This.X
, Y := This.Y
, X2 := X * Co - Y * Si
, Y2 := X * Si + Y * Co
if( !NewVector )
This.X := X2 , This.Y := Y2
else
return New Vector( X2 , Y2 )
}
;********************************************
;class methods
TestLineInterceptPoint( interceptPoint , Line1 , Line2 ){ ; Line = { Start: { X: , Y: } , End: { X: , Y: } } , interceptPoint = { X: , Y: }
local
for k , v in [ "X" , "Y" ]
M%v%_Min := min( Line1.Start[ v ] , Line1.End[ v ] )
,M%v%_Max := max( Line1.Start[ v ] , Line1.End[ v ] )
,L%v%_Min := min( Line2.Start[ v ] , Line2.End[ v ] )
,L%v%_Max := max( Line2.Start[ v ] , Line2.End[ v ] )
if( !( interceptPoint.X < Mx_Min || interceptPoint.X > Mx_Max || interceptPoint.X < Lx_Min || interceptPoint.X > Lx_Max ) && !( interceptPoint.Y < My_Min || interceptPoint.Y > My_Max || interceptPoint.Y < Ly_Min || interceptPoint.Y > Ly_Max ) )
return 1
return 0
}
GetLineInterceptPoint( Line1 , Line2 ){ ; Line = { Start: { X: , Y: } , End: { X: , Y: } }
local A1 := Line1.End.Y - Line1.Start.Y
,B1 := Line1.Start.X - Line1.End.X
,C1 := A1 * Line1.Start.X + B1 * Line1.Start.Y
,A2 := Line2.End.Y - Line2.Start.Y
,B2 := Line2.Start.X - Line2.End.X
,C2 := A2 * Line2.Start.X + B2 * Line2.Start.Y
,Denominator := A1 * B2 - A2 * B1
return New Vector( { X: ( ( B2 * C1 - B1 * C2 ) / Denominator ) , Y: ( ( A1 * C2 - A2 * C1 ) / Denominator ) } )
}
;********************************************
}
;**************************************************************************************************************************************************************************
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;**************************************************************************************************************************************************************************
Code: Select all
; Digital clock made out of segments using progress bar LOL
; Author: Arekusei
#NoEnv
#NoTrayIcon
SetBatchLines,-1
global WinTitle := "Digital Clock"
Menu, SectionMenu, Add, ❌ | Exit`tDel, Exit
;Menu, Tray, DeleteAll
Menu, Tray, NoStandard
Menu, Tray, Add, Show/Hide, Menu_ShowHide
Menu, Tray, Add,
Menu, Tray, Add, Exit, Exit
Menu, Tray, Default, Show/Hide
Menu, Tray, Click, 1 ;opens on single click
Menu, Tray, Tip , % WinTitle
Menu, Tray, UseErrorLevel
hICON := Base64toHICON() ; Create a HICON
Menu, Tray, Icon, HICON:*%hICON% ; AHK makes a copy of HICON when * is used
Menu, Tray, Icon
DllCall( "DestroyIcon", "Ptr",hICON ) ; Destroy original HICON
ST:= A_TickCount
global width:= 27, height:= 5
global map:=
(Join
"1,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1
,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1
,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1
,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1
,1,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1"
)
map := StrSplit(map, ",")
digit0:= [2,2,2, 2,1,2, 2,1,2, 2,1,2, 2,2,2] ;0
digit1:= [1,1,2, 1,1,2, 1,1,2, 1,1,2, 1,1,2] ;1
digit2:= [2,2,2, 1,1,2, 2,2,2, 2,1,1, 2,2,2] ;2
digit3:= [2,2,2, 1,1,2, 2,2,2, 1,1,2, 2,2,2] ;3
digit4:= [2,1,2, 2,1,2, 2,2,2, 1,1,2, 1,1,2] ;4
digit5:= [2,2,2, 2,1,1, 2,2,2, 1,1,2, 2,2,2] ;5
digit6:= [2,2,2, 2,1,1, 2,2,2, 2,1,2, 2,2,2] ;6
digit7:= [2,2,2, 1,1,2, 1,1,2, 1,1,2, 1,1,2] ;7
digit8:= [2,2,2, 2,1,2, 2,2,2, 2,1,2, 2,2,2] ;8
digit9:= [2,2,2, 2,1,2, 2,2,2, 1,1,2, 2,2,2] ;9
; arrays start from 1 in ahk ---------------
;loop % width * height
;map.push(0)
global mrg:= 6 ;margin
global size := 8 ;tile size
Gui,Margin, %mrg% , %mrg%
num:= []
global tilecolors:= ["c272828","c4E9D9D"]
;global tilecolors:= ["cAE81FF","cF92672"]
;global tilecolors:= ["cBB1818","cF8F96B"]
;global tilecolors:= ["c2D1A1B", "c604141"]
cback := tilecolors[1]
Loop % width * height
{
n:=A_Index -1
x := (Mod(n, width) * size) +mrg
y := (n // width * size) + mrg
;get position without margin
;xpos:= Floor((Mod(n, width) * size) / size)
;ypos:= Floor((n // width * size) / size)
xpos:= Floor((x-mrg) / size)
ypos:= Floor((y-mrg) / size)
arrPos:= (ypos) * (width) + xpos
;msgbox % xpos "`n" ypos "`n" arrpos
;color := tilecolors[map[arrpos+1]+1]
color := tilecolors[map[arrpos+1]+1]
;msgbox % color
Gui, Add,Progress, x%x% y%y% w%size% h%size% Disabled -Smooth vBAR%n% Background%color%
;Gui, Add, Picture, x%x% y%y% w%size% h%size% vBAR%n% Background%color%,
}
;Gui Add, Text, x1 y1 w157 h58 0x7 BackGroundTrans gWM_LBUTTONDOWN
Gosub firstcheck
SetTimer, Check, 100
OnMessage(0x201, "WM_LBUTTONDOWN") ;to move gui
Gui, Color, % cback ;0x272828 ;0x33BBA5
gui, +AlwaysOnTop -Caption +ToolWindow +border ;+Resize
Gui,Show, , % WinTitle
;sub menu / context menu
Gui menu:Default
Gui, +AlwaysOnTop -Caption +Border +ToolWindow
Gui, Color, 22262a
;Gui, Font, s8 Bold, Segoe UI
Gui, Font, s10 Bold, Segoe UI
Gui, Margin, 2, 2
addBtn("Minimize")
addBtn("Exit","F8F96B","BB1818")
Return
addBtn(text:="btn", cText:="4E9D9D", cBack:="272828", w:= 100, h:=20, pos:= "xm+0", menu:= "menu"){
Global
Static count:= 0
count++
Gui %menu%:Default
Gui, Add,Progress, % pos " w" w " h" h " Disabled Background" cback
Gui, Add , Text , % " xp yp w" w " h" h " border Center BackgroundTrans glaunch c" cText " vbtn" count , % text
launch := Func("launch").Bind(text)
GuiControl,+G, btn%count%, %launch%
}
RunIt:
MouseGetPos,,,, ctrl, 2
;MsgBox test ;% ctrl
try{
;ToolTip, % ControlHandles[ ctrl ].RunPath
gosub % ControlHandles[ ctrl ].RunPath
;ControlHandles[ ctrl ].RunPath
}catch{
;MsgBox, ERROR
}
Gui, menu:Hide
return
launch(arg){
;ToolTip % A_GuiControl "`n" arg
;return
Gui, menu:Hide ;hide before action or it will look delayed
try{
Gosub % arg
} catch {
;ToolTip some problem occured
}
}
GuiContextMenu: ; Launched in response to a right-click or press of the Apps key.
;ToolTip % A_EventInfo ;A_GuiControl ;wot ze fok
;Menu, SectionMenu, Show , %A_GuiX%, %A_GuiY%
CoordMode, Mouse, Screen
MouseGetPos, x , y
Gui, menu:Show, % "x" x - 1 " y" y - 1, subMenu
return
~*LButton::
~*RButton::
if (!MouseIsOver("subMenu")){
Gui menu:Hide
;ToolTip
}
return
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return !!WinExist(WinTitle . " ahk_id " . Win)
}
;Menu_ShowHide(){
Minimize:
Menu_ShowHide:
WinGet, winStyle, Style, %WinTitle%
if (winStyle & 0x10000000)
{
WinHide, %WinTitle%
}
else
{
WinShow, %WinTitle%
WinActivate , %WinTitle%
WinSet, AlwaysOnTop, Toggle, %WinTitle%
WinSet, AlwaysOnTop, Toggle, %WinTitle%
}
ToolTip
;}
return
;#If MouseIsOver(WinTitle)
;#if
getpos(){
while (GetKeyState("Lbutton", "P")){
CoordMode Mouse , Client
MouseGetPos x,y
xpos:= Floor((x-10) / 16)
ypos:= Floor((y-10) / 16)
arrPos:= (ypos) * 27 + (xpos)
ToolTip % (ypos*width)+xpos+1
MouseGetPos, , , HWIN, HCTRL, 2
GuiControlGet, VarName, %HWIN%:Name, %HCTRL%
;ToolTip % VarName
if (InStr(VarName, "clr"))
selectedColor:= SubStr(VarName, 4)
;ToolTip % "X: " x " Y: " y " Tile: " (ypos*width)+xpos+1 " `nXpos: " xpos " Ypos: " ypos "`nS " selectedColor " COLORS: " tilecolors[selectedColor+1] , -30, -30
map[arrpos+1]:= selectedColor
;GuiControl, % "+Backgroundc" SubStr("0xFF0000", 3) , % VarName
GuiControl, % "+Background" tilecolors[selectedColor+1] , % VarName
;GuiControl,+Redraw, % VarName
sleep 20
}
}
return
;q::
check:
;quick fix for performance reasons lol
if ((ST+1000) > A_TickCount) {
return
} else {
ST:= A_TickCount
}
firstcheck:
;if (num = 10)
hours:= StrSplit(A_Hour)
mins:= StrSplit(A_Min)
secs:= StrSplit(A_Sec)
num:= secs.2
digit := digit%num%
;Random clr, 1,6
sectors := {0:hours.1, 4:hours.2, 10:mins.1, 14:mins.2 , 20:secs.1, 24:secs.2}
for sk, sv in sectors{
;MsgBox % sk "`n" sv
digit:= digit%sv% ;select digit
for k,v in digit{
;msgbox % k "`n" v
;msgbox % s
i := (Floor((k-1)/3) * 27) + sk + mod(k-1,3)
GuiControl, % "+Background" tilecolors[digit[k]] , BAR%i% ;VarName
}
}
;sleep 100
return
WM_LBUTTONDOWN() {
;PostMessage, WM_NCLBUTTONDOWN := 0xA1, HTCAPTION := 2
SetTimer Check, off ;need to avoid conflic from timer
PostMessage, 0xA1, 2
While(GetKeyState("LButton")){
sleep 100
}
SetTimer Check, 100
}
Move_Window:
PostMessage,0xA1,2
While(GetKeyState("LButton"))
sleep 10
return
; Ask for help topic: https://autohotkey.com/boards/viewtopic.php?t=36640
Base64toHICON() { ; 16x16 PNG image (236 bytes), requires WIN Vista and later
Local B64 :="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAI1JREFUOE9j9Js79z8DBYARZMD5xkayjDCsr2eAG8DFxUWyIeqlpdgNAElgAyCXIluE1wB0b4GcS18DPj56hOILfjk54l0A0gnyH8wQbJphavDGAiww0f0OcxrOQISZDgtIWACCxOkbC0qJiQz35s8Hu5jkaESOBZAhJBtAUUr89u0bznyBNRBJzkVIGgC2WJSBjuiNYgAAAABJRU5ErkJggg==", Bin, Blen, nBytes:=236, hICON:=0
VarSetCapacity( Bin,nBytes,0 ), BLen := StrLen(B64)
If DllCall( "Crypt32.dll\CryptStringToBinary", "Str",B64, "UInt",BLen, "UInt",0x1
, "Ptr",&Bin, "UIntP",nBytes, "Int",0, "Int",0 )
hICON := DllCall( "CreateIconFromResourceEx", "Ptr",&Bin, "UInt",nBytes, "Int",True
, "UInt",0x30000, "Int",16, "Int",16, "UInt",0, "UPtr" )
Return hICON
}
GuiClose:
;*ESC::
exit:
;esc::
ExitApp
Code: Select all
#SingleInstance Force
SetBatchLines, -1
;*******************************************
Gui1 := {}
Gui1.Scale := 1
;*******************************************
Gui, New, +AlwaysOnTop +hwndhwnd -DPIScale +Resize
Gui1.Hwnd := hwnd
;*******************************************
Gui1.MarginX := 1
Gui1.MarginY := 1
Gui, % Gui1.Hwnd ":Margin", % Gui1.MarginX , % Gui1.MarginY
;*******************************************
Gui1.FontType := "Segoe UI"
Gui1.FontSize := 10
Gui1.FontColor := "000000"
Gui1.FontOptions := ""
SetWindowFont( Gui1 )
;;*******************************************
Gui1.Controls := {}
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;Control Name Parent Object , Control Type , Options , Display Value , Rows
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gui1.Controls.ColorListBox := CreateControl( Gui1 , "ListBox" , "xm ym w250 h200 Multi" , "hwnd|posX||posY|posW|posH|Type|WinObj|DisplayValue|Options|" )
Gui1.Controls.CheckMeCheckBox := CreateControl( Gui1 , "Checkbox" , "x+m yp Checked section " , "Check Me!" )
Gui1.Controls.HideButton := CreateControl( Gui1 , "Button" , "xs y+m wp" , "Hide" )
Gui1.Controls.ShowButton := CreateControl( Gui1 , "Button" , "xs y+m wp" , "Show" )
Gui1.Controls.Option1Radio := CreateControl( Gui1 , "Radio" , "xs y+m wp Checked" , "Option 1" )
Gui1.Controls.Option2Radio := CreateControl( Gui1 , "Radio" , "xs y+m wp" , "Option 2" )
Gui1.Controls.TTestDDL := CreateControl( Gui1 , "DDL" , "xs y+m w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
;Gui1.Controls.newButton := CreateControl( Gui1 , "DDL" , "x300 y300 w200 r10" , "Item||Item|Item|Item|Item|Item|Item|Item|Item|Item|Item|" , 10 )
;Gui1.Controls.newButton := CreateControl( Hov.push(New Button(500,500,100,25,,"Submit","Submit","ff0000")))
;Hov.push(New Button(500,500,100,25,,"Submit","Submit","ff0000"))
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gui, Show, AutoSize , Scale via +Resize
;;*******************************************
WinGetPos,,, w , h , % "ahk_id " Gui1.Hwnd
Gui1.W := w
Gui1.H := h
;;*******************************************
Gui1.Scale := A_ScreenDPI / 96
ScaleControls( Gui1 , Gui1.Scale )
;;*******************************************
return ;<<<<---- End of the auto-exectute section of the script.
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit Routine
GuiClose:
GuiContextMenu:
*ESC::ExitApp
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +RESIZE
GuiSize: ;{
if( !init && init := 1 )
return
WinGetPos,,, w, h , % "ahk_id " Gui1.Hwnd
Gui1.Scale := w / Gui1.W
ScaleControls( Gui1 , Gui1.Scale )
sleep, 30
return
;}
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HOTKEYS
F1:: ScaleControls( Gui1 , Gui1.Scale := 1 )
;;*******************************************
F2:: ScaleControls( Gui1 , Gui1.Scale := 1.5 )
;;*******************************************
F3:: ScaleControls( Gui1 , Gui1.Scale := 2 )
;;*******************************************
F4:: ScaleControls( Gui1 , Gui1.Scale := .7 )
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Functions
ScaleControls( Gui1 , Scale := 1 ){
static lastSize
for k , v in Gui1.Controls {
cc := Gui1.Controls[ k ]
x := cc.X * Scale
y := cc.Y * Scale
w := cc.W * Scale
if( cc.Rows )
h := cc.Rows * GetRowHeight( cc.FontType , size , cc.FontOptions )
else
h := cc.H * Scale
size := ( cc.FontSize / ( A_ScreenDPI / 96 ) ) * scale
if( size != lastSize && lastSize := Size )
Gui, % Gui1.Hwnd ":Font" , % "norm s" size " c" cc.FontColor " " cc.FontOptions , % cc.FontType
GuiControl, % Gui1.Hwnd ":Font" , % cc.Hwnd
GuiControl, % Gui1.Hwnd ":MoveDraw" , % cc.Hwnd , % "x" X " y" Y " w" W " h" H
}
Gui, % Gui1.hwnd ":Margin", % Gui1.MarginX * scale , % Gui1.MarginY * scale
Gui, % Gui1.Hwnd ":Show" , AutoSize
}
;;*******************************************
GetRowHeight( FontType , FontSize , FontOptions ){
Gui, Dummy:Font, % "s" FontSize " " FontOptions , % FontType
Gui, Dummy:Add, Text,, % "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyyYzZ1!2@3#4$5%6^7&8*9(0)-_=+[{]}\|,<.>/?"
GuiControlGet, pos , Dummy:pos , static1
Gui, Dummy:Destroy
return posH
}
;;*******************************************
SetWindowFont( Gui1 ){
local size := Gui1.FontSize / ( A_ScreenDPI / 96 )
Gui, % Gui1.Hwnd ":Font" , % "norm s" size " c" Gui1.FontColor " " Gui1.FontOptions , % Gui1.FontType
}
;;*******************************************
CreateControl( WinObj , Type := "Button" , Options := "" , DisplayValue := "" , Rows := "" ){
local obj := {}
Gui, % WinObj.Hwnd ":Add" , % Type , % Options " +hwndhwnd" , % DisplayValue
GuiControlGet, pos , % WinObj.Hwnd ":pos" , % hwnd
obj.Hwnd := hwnd
obj.Rows := Rows
obj.X := posX
obj.Y := posY
obj.W := posW
obj.H := posH
obj.Type := Type
obj.Parent := WinObj.Hwnd
obj.DisplayValue := DisplayValue
obj.Options := Options
obj.FontType := WinObj.FontType
obj.FontSize := WinObj.FontSize
obj.FontColor := WinObj.FontColor
obj.FontOptions := WinObj.FontOptions
return obj
}
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
submit:
return
;######################################################################################################################
;##################################################### ###################################
;##################################################### sec.Hover ###################################
;##################################################### ###################################
;######################################################################################################################
Hov_Hover(){
static Hover_On,Index
MouseGetPos,,,,ctrl,2
if(!Hover_On&&ctrl){
Loop,% Hov.Length() {
if(ctrl=Hov[A_Index].Hwnd)
Hov[A_Index].Draw_Hover(),Index:=A_Index,Hover_On:=1,break
}
}else if(Hover_On){
if(Hov[Index].Hwnd!=ctrl)
Hov[Index].Draw_Default(),Hover_On:=0
}
}
;######################################################################################################################################
;##################################################### #######################################################
;##################################################### sec.Button #######################################################
;##################################################### #######################################################
;######################################################################################################################################
class Button{
__New( x := 10 , y := 10 , w := 150 , h := 40 , Window := "1", Text := "Button",Label := "" , Button_Color := "" , Button_Background_Color:= "" , Font := "Tahoma" , Font_Size := "16" , Font_Color_Top := "000000" , Font_Color_Bottom := "FFFFFF" ){
This.Text_Color_Top := "0xFF" Config[10] , This.Text_Color_Bottom := "0xFF000000" , This.Font := Config[9] , This.Font_Size := Config[11]
This.X := x , This.Y := y , This.W := w , This.H := h , This.Window := Window , This.Text := Text ,This.Label := Label, This.Button_Background_Color := "0xFF" Button_Background_Color , This.Button_Color := "0xFF" Button_Color
This.Create_Default_Bitmap() , This.Create_Hover_Bitmap() , This.Create_Pressed_Bitmap() , This.Create_Trigger()
sleep, 20
This.Draw_Default()
}
Create_Trigger(){
global
; num := Button.Length() + 1
Gui , % This.Window ": Add" , Picture , % "x" This.X " y" This.Y " w" This.W " h" This.H " hwndHwnd_" Num " v" Num " g" This.Label " 0xE"
This.Number := Num , This.Hwnd := Hwnd_%num%
}
Create_Default_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W, This.H )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF222222" )
Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 5 )
Gdip_DeleteBrush( Brush )
if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
else
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , This.Button_Color , "0xFF333333" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter c" Brush " x-1 y-1" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter c" Brush " x0 y0" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Default_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Hover_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W , This.H )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF" Config[3] )
Gdip_FillRoundedRectangle( G , Brush , 1 , -1 , This.W-2 , This.H+1 , Config[10] )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF222222" )
Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , Config[10] )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , Config[10] )
Gdip_DeleteBrush( Brush )
if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , "0xFF444444" , This.Button_Color , 1 , 1 )
else
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , This.Button_Color , "0xFF444444" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , Config[10] )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-1" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y0" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Hover_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
Gdip_DisposeImage(pBitmap)
}
Create_Pressed_Bitmap(){
pBitmap:=Gdip_CreateBitmap( This.W , This.H )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF222222" )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , 0 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-2" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y-1" , This.Font , This.W , This.H )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
This.Pressed_Bitmap := Gdip_CreateHBITMAPFromBitmap( pBitmap )
Gdip_DisposeImage( pBitmap )
}
Draw_Default(){
SetImage( This.Hwnd , This.Default_Bitmap )
}
Draw_Hover(){
SetImage( This.Hwnd , This.Hover_Bitmap )
}
Draw_Pressed(){
SetImage( This.Hwnd , This.Pressed_Bitmap )
SetTimer , Hov_Hover , Off
While( GetKeyState( "LButton" ) )
sleep , 10
SetTimer , Hov_Hover , On
MouseGetPos,,,, ctrl , 2
if( This.Hwnd != ctrl ){
This.Draw_Default()
return False
}else {
This.Draw_Hover()
return true
}
}
}
;######################################################################################################################
;##################################################### ###################################
;##################################################### sec.custom gdip ###################################
;##################################################### ###################################
;######################################################################################################################
Gdip_Startup()
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
return pToken
}
Gdip_CreateBitmap(Width, Height, Format=0x26200A)
{
DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
Return pBitmap
}
Gdip_GraphicsFromImage(pBitmap)
{
DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
return pGraphics
}
Gdip_SetSmoothingMode(pGraphics, SmoothingMode)
{
return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", SmoothingMode)
}
Gdip_BrushCreateSolid(ARGB=0xff000000)
{
DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
return pBrush
}
Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillRectangle"
, Ptr, pGraphics
, Ptr, pBrush
, "float", x
, "float", y
, "float", w
, "float", h)
}
Gdip_DeleteBrush(pBrush)
{
return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt", pBrush)
}
Gdip_CreatePen(ARGB, w)
{
DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
return pPen
}
Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawRectangle", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
}
Gdip_DeletePen(pPen)
{
return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt", pPen)
}
Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0)
{
IWidth := Width, IHeight:= Height
RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
RegExMatch(Options, "i)NoWrap", NoWrap)
RegExMatch(Options, "i)R(\d)", Rendering)
RegExMatch(Options, "i)S(\d+)(p*)", Size)
if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
PassBrush := 1, pBrush := Colour2
if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
return -1
Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
Loop, Parse, Styles, |
{
if RegExMatch(Options, "\b" A_loopField)
Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
}
Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
Loop, Parse, Alignments, |
{
if RegExMatch(Options, "\b" A_loopField)
Align |= A_Index//2.1 ; 0|0|1|1|2|2
}
xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
if !PassBrush
Colour := "0x" (Colour2 ? Colour2 : "ff000000")
Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
hFamily := Gdip_FontFamilyCreate(Font)
hFont := Gdip_FontCreate(hFamily, Size, Style)
FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
hFormat := Gdip_StringFormatCreate(FormatStyle)
pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
if !(hFamily && hFont && hFormat && pBrush && pGraphics)
return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
CreateRectF(RC, xpos, ypos, Width, Height)
Gdip_SetStringFormatAlign(hFormat, Align)
Gdip_SetTextRenderingHint(pGraphics, Rendering)
ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
if vPos
{
StringSplit, ReturnRC, ReturnRC, |
if (vPos = "vCentre") || (vPos = "vCenter")
ypos += (Height-ReturnRC4)//2
else if (vPos = "Top") || (vPos = "Up")
ypos := 0
else if (vPos = "Bottom") || (vPos = "Down")
ypos := Height-ReturnRC4
CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
}
if !Measure
E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
if !PassBrush
Gdip_DeleteBrush(pBrush)
Gdip_DeleteStringFormat(hFormat)
Gdip_DeleteFont(hFont)
Gdip_DeleteFontFamily(hFamily)
return E ? E : ReturnRC
}
Gdip_DeleteGraphics(pGraphics)
{
return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff)
{
DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "uint*", hbm, "int", Background)
return hbm
}
SetImage(hwnd, hBitmap)
{
SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
E := ErrorLevel
DeleteObject(E)
return E
}
Gdip_DisposeImage(pBitmap)
{
return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt", pBitmap)
}
DeleteObject(hObject)
{
return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
}
Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillEllipse", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
}
Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1)
{
CreateRectF(RectF, x, y, w, h)
DllCall("gdiplus\GdipCreateLineBrushFromRect", A_PtrSize ? "UPtr" : "UInt", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
return LGpBrush
}
Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r)
{
Region := Gdip_GetClipRegion(pGraphics)
Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
Gdip_SetClipRegion(pGraphics, Region, 0)
Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
Gdip_SetClipRegion(pGraphics, Region, 0)
Gdip_DeleteRegion(Region)
return E
}
Gdip_FillPie(pGraphics, pBrush, x, y, w, h, StartAngle, SweepAngle)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillPie"
, Ptr, pGraphics
, Ptr, pBrush
, "float", x
, "float", y
, "float", w
, "float", h
, "float", StartAngle
, "float", SweepAngle)
}
Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r)
{
Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
Gdip_ResetClip(pGraphics)
Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
Gdip_ResetClip(pGraphics)
return E
}
Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawLine"
, Ptr, pGraphics
, Ptr, pPen
, "float", x1
, "float", y1
, "float", x2
, "float", y2)
}
Gdip_CloneBrush(pBrush)
{
DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt", pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
return pBrushClone
}
Gdip_FontFamilyCreate(Font)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if (!A_IsUnicode)
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, "uint", 0, "int", 0)
VarSetCapacity(wFont, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, Ptr, &wFont, "int", nSize)
}
DllCall("gdiplus\GdipCreateFontFamilyFromName"
, Ptr, A_IsUnicode ? &Font : &wFont
, "uint", 0
, A_PtrSize ? "UPtr*" : "UInt*", hFamily)
return hFamily
}
Gdip_FontCreate(hFamily, Size, Style=0)
{
DllCall("gdiplus\GdipCreateFont", A_PtrSize ? "UPtr" : "UInt", hFamily, "float", Size, "int", Style, "int", 0, A_PtrSize ? "UPtr*" : "UInt*", hFont)
return hFont
}
Gdip_StringFormatCreate(Format=0, Lang=0)
{
DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, A_PtrSize ? "UPtr*" : "UInt*", hFormat)
return hFormat
}
CreateRectF(ByRef RectF, x, y, w, h)
{
VarSetCapacity(RectF, 16)
NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
}
Gdip_SetStringFormatAlign(hFormat, Align)
{
return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" : "UInt", hFormat, "int", Align)
}
Gdip_SetTextRenderingHint(pGraphics, RenderingHint)
{
return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", RenderingHint)
}
Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
VarSetCapacity(RC, 16)
if !A_IsUnicode
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, "uint", 0, "int", 0)
VarSetCapacity(wString, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
}
DllCall("gdiplus\GdipMeasureString"
, Ptr, pGraphics
, Ptr, A_IsUnicode ? &sString : &wString
, "int", -1
, Ptr, hFont
, Ptr, &RectF
, Ptr, hFormat
, Ptr, &RC
, "uint*", Chars
, "uint*", Lines)
return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
}
Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if (!A_IsUnicode)
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, 0, "int", 0)
VarSetCapacity(wString, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
}
return DllCall("gdiplus\GdipDrawString"
, Ptr, pGraphics
, Ptr, A_IsUnicode ? &sString : &wString
, "int", -1
, Ptr, hFont
, Ptr, &RectF
, Ptr, hFormat
, Ptr, pBrush)
}
Gdip_DeleteStringFormat(hFormat)
{
return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" : "UInt", hFormat)
}
Gdip_DeleteFont(hFont)
{
return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt", hFont)
}
Gdip_DeleteFontFamily(hFamily)
{
return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" : "UInt", hFamily)
}
Gdip_GetClipRegion(pGraphics)
{
Region := Gdip_CreateRegion()
DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
return Region
}
Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0)
{
return DllCall("gdiplus\GdipSetClipRect", A_PtrSize ? "UPtr" : "UInt", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
}
Gdip_SetClipRegion(pGraphics, Region, CombineMode=0)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr, Region, "int", CombineMode)
}
Gdip_DeleteRegion(Region)
{
return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" : "UInt", Region)
}
Gdip_ResetClip(pGraphics)
{
return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawEllipse", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
}
Gdip_CreateRegion()
{
DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
return Region
}
Gdip_Shutdown(pToken)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
DllCall("gdiplus\GdiplusShutdown", Ptr, pToken)
if hModule := DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("FreeLibrary", Ptr, hModule)
return 0
}
Hi Joe.joekingcool wrote: ↑01 Mar 2024, 13:06@Hellbent
i started tring to merge my gui with your scale gui. been following allot of it. not sure how to make them compatible. i tried to just plug in functions into your gui scale. i expected it would be long shot. i understand some things in how your scaling so might be able to tweak somethings in my gui. i just dont think will be able to make it fully scalable like yours.
plus i still dont understand how to make the buttons stacked when you do that xm ym y+m stuff lol
heres example of when i tried to add to cutom buttons to your gui, below.
You shouldn't have to worry too much about that if you know how to manually set the controls to relative positions or if you know the absolute positions of the controls.plus i still dont understand how to make the buttons stacked when you do that xm ym y+m stuff lol
Code: Select all
prevControl_Y := 50
prevControl_H := 50
margin_Y := 10
Y_Pos := prevControl_Y + prevControl_H + margin_Y
;.......... " y" Y_Pos
Code: Select all
Gui, Margin, 10 , 10
Gui, Add, Button, xm ym w100 h50 hwndButtonHwnd
Button1 := {X:10,Y:10,W:100,H:50,Hwnd: ButtonHwnd}
Scale := 3
x := Button1.X * Scale
y := Button1.Y * Scale
w := Button1.W * Scale
h := Button1.H * Scale
GuiControl, MoveDraw, % Button1.Hwnd, % "x" x " y" y " w" w " h" h
Return to “Scripts and Functions (v1)”
Users browsing this forum: No registered users and 53 guests