How to change the color and font of a GUI button when I hover mouse pointer over it?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

How to change the color and font of a GUI button when I hover mouse pointer over it?

01 May 2019, 13:23

Please look at this gif-
ram4.gif
ram4.gif (124.57 KiB) Viewed 639 times
In above video you can see that when i bring cursor on any button then it changes the color of that button (perhaps slightly the font and color also). I want to know which part of the codes create such effect in GUI. In fact this is smart clicker program which is quite awesome created by Hellbent. The codes of this program is following-

Code: Select all

;#######################################################################################################################################
;#######################################################################################################################################
;#######################################################################################################################################
/*
		Written By: Hellbent aka CivReborn (https://www.youtube.com/user/CivReborn)
		Date Written: March 14th, 2019
		Name: Smart Clicker v1.2.2 Release Copy
		PasteBin Save: https://pastebin.com/W3iEKsWc
*/
;#######################################################################################################################################
;#######################################################################################################################################
;#######################################################################################################################################
#SingleInstance,Force
#NoEnv
CoordMode,Mouse,Screen
SetTitleMatchMode,2
OnMessage(0x05,"Min")
global Main:={W:350,H:365},Button:=[],Use_Target_Window:=1,Use_Click_Delay:=1,Turbo_Mode:=0,Click_Delay:=30,Stop:=1,Target_Window:="",Box_Width:=80,Box_Height:=80,windowhwnd,Mouse_Delay:=30,Click_X:="",Click_Y:="",Sounds:=1
SetMouseDelay,% Mouse_Delay
SetBatchLines,10ms
SetUp()
return
GuiClose(){
	ExitApp
}
BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster=""){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("gdi32\BitBlt", Ptr, dDC, "int", dx, "int", dy, "int", dw, "int", dh, Ptr, sDC, "int", sx, "int", sy, "uint", Raster ? Raster : 0x00CC0020)
}
Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	if (Matrix&1 = "")
		ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
	else if (Matrix != 1)
		ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
	if(sx = "" && sy = "" && sw = "" && sh = ""){
		if(dx = "" && dy = "" && dw = "" && dh = ""){
			sx := dx := 0, sy := dy := 0
			sw := dw := Gdip_GetImageWidth(pBitmap)
			sh := dh := Gdip_GetImageHeight(pBitmap)
		}else	{
			sx := sy := 0,sw := Gdip_GetImageWidth(pBitmap),sh := Gdip_GetImageHeight(pBitmap)
		}
	}
	E := DllCall("gdiplus\GdipDrawImageRectRect", Ptr, pGraphics, Ptr, pBitmap, "float", dx, "float", dy, "float", dw, "float", dh, "float", sx, "float", sy, "float", sw, "float", sh, "int", 2, Ptr, ImageAttr, Ptr, 0, Ptr, 0)
	if ImageAttr
		Gdip_DisposeImageAttributes(ImageAttr)
	return E
}
Min_Window(){
	Gui,1:Minimize
}
Gdip_SetImageAttributesColorMatrix(Matrix){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	VarSetCapacity(ColourMatrix, 100, 0)
	Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
	StringSplit, Matrix, Matrix, |
	Loop, 25
	{
		Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
		NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
	}
	DllCall("gdiplus\GdipCreateImageAttributes", A_PtrSize ? "UPtr*" : "uint*", ImageAttr)
	DllCall("gdiplus\GdipSetImageAttributesColorMatrix", Ptr, ImageAttr, "int", 1, "int", 1, Ptr, &ColourMatrix, Ptr, 0, "int", 0)
	return ImageAttr
}
Gdip_GetImageWidth(pBitmap){
   DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Width)
   return Width
}
Gdip_GetImageHeight(pBitmap){
   DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Height)
   return Height
}
Move_Window(){
	SetTimer,Watch_Hover,Off
	PostMessage,0xA1,2
	While(GetKeyState("LButton"))
		sleep, 10
	SetTimer,Watch_Hover,On
	Min()
}
Gdip_DeletePen(pPen){
   return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt", pPen)
}
Gdip_DeleteBrush(pBrush){
   return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt", pBrush)
}
Gdip_DisposeImage(pBitmap){
   return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt", pBitmap)
}
Gdip_DeleteGraphics(pGraphics){
   return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Gdip_DisposeImageAttributes(ImageAttr){
	return DllCall("gdiplus\GdipDisposeImageAttributes", A_PtrSize ? "UPtr" : "UInt", ImageAttr)
}
Gdip_DeleteFont(hFont){
   return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt", hFont)
}
Gdip_DeleteStringFormat(hFormat){
   return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" : "UInt", hFormat)
}
Gdip_DeleteFontFamily(hFamily){
   return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" : "UInt", hFamily)
}
Min(){
	sleep,30
	if(WinActive("Ahk_Id" windowhwnd)){
		BitBlt(Main.hdc1 , 0, 0, Main.W, Main.H, Main.hdc2 ,0, 0) 
		loop 5
			GuiControl,1:+Redraw,Edit%A_Index%
	}
}
Reload(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	Reload
}
CreateCompatibleDC(hdc=0){
   return DllCall("CreateCompatibleDC", A_PtrSize ? "UPtr" : "UInt", hdc)
}
SelectObject(hdc, hgdiobj){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("SelectObject", Ptr, hdc, Ptr, hgdiobj)
}
DeleteObject(hObject){
   return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
}
GetDC(hwnd=0){
	return DllCall("GetDC", A_PtrSize ? "UPtr" : "UInt", hwnd)
}
GetDCEx(hwnd, flags=0, hrgnClip=0){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
    return DllCall("GetDCEx", Ptr, hwnd, Ptr, hrgnClip, "int", flags)
}
ReleaseDC(hdc, hwnd=0){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("ReleaseDC", Ptr, hwnd, Ptr, hdc)
}
DeleteDC(hdc){
   return DllCall("DeleteDC", A_PtrSize ? "UPtr" : "UInt", hdc)
}
Get_More_Clickers(){
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1	
	try
		run, https://www.youtube.com/playlist?list=PLPI5C2_hIGGw7poIqgox3rDnyocwTxcY_
}
Gdip_SetClipRegion(pGraphics, Region, CombineMode=0){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr, Region, "int", CombineMode)
}
Use_Click_Delay_Func(){
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	Use_Click_Delay:=!Use_Click_Delay
	if(Use_Click_Delay)
		Gdip_DrawImage( Main.G, Switch_On(), 145, 228, 59, 22)
	else
		Gdip_DrawImage( Main.G, Switch_Off(), 145, 228, 59, 22)
	
	BitBlt(Main.hdc1 , 145, 228, 59, 22 , Main.hdc2 , 145, 228) 
}
CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	hdc2 := hdc ? hdc : GetDC()
	VarSetCapacity(bi, 40, 0)
	NumPut(w, bi, 4, "uint"), NumPut(h, bi, 8, "uint"), NumPut(40, bi, 0, "uint"), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16, "uInt"), NumPut(bpp, bi, 14, "ushort")
	hbm := DllCall("CreateDIBSection", Ptr, hdc2, Ptr, &bi, "uint", 0, A_PtrSize ? "UPtr*" : "uint*", ppvBits, Ptr, 0, "uint", 0, Ptr)
	if !hdc
		ReleaseDC(hdc2)
	return hbm
}
Use_Turbo_Mode_Func(){
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	Turbo_Mode:=!Turbo_Mode
	if(Turbo_Mode)
		Gdip_DrawImage( Main.G, Switch_On(), 145, 255, 59, 22)
	else
		Gdip_DrawImage( Main.G, Switch_Off(), 145, 255, 59, 22)
	
	BitBlt(Main.hdc1 , 145, 255, 59, 22 , Main.hdc2 , 145, 255) 
}
Gdip_GraphicsFromImage(pBitmap){
	DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
	return pGraphics
}
Gdip_GraphicsFromHDC(hdc){
    DllCall("gdiplus\GdipCreateFromHDC", A_PtrSize ? "UPtr" : "UInt", hdc, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
    return pGraphics
}
Gdip_GetDC(pGraphics){
	DllCall("gdiplus\GdipGetDC", A_PtrSize ? "UPtr" : "UInt", pGraphics, A_PtrSize ? "UPtr*" : "UInt*", hdc)
	return hdc
}
Use_Target_Window_Func(){
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	Use_Target_Window:=!Use_Target_Window
	if(Use_Target_Window)
		Gdip_DrawImage( Main.G, Switch_On(), 145, 50, 59, 22)
	else
		Gdip_DrawImage( Main.G, Switch_Off(), 145, 50, 59, 22)
	
	BitBlt(Main.hdc1 , 145, 50, 59, 22 , Main.hdc2 , 145, 50) 
}
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
}
Use_Sounds_Func(){
	Sounds:=!Sounds
	if(Sounds)
		Gdip_DrawImage( Main.G2, Switch_On(), 265, 94, 59, 22)
	else
		Gdip_DrawImage( Main.G2, Switch_Off(), 265, 94, 59, 22)
	BitBlt(Main.hdc3 , 265, 94, 59, 22 , Main.hdc4 , 265, 94) 
}
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_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)
}
Update_Target_Window(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	GuiControlGet,Target_Window,1:,Target_Window
}
Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
	DllCall("gdiplus\GdipCreateLineBrush", Ptr, &PointF1, Ptr, &PointF2, "Uint", ARGB1, "Uint", ARGB2, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
	return LGpBrush
}
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_CloneBrush(pBrush){
	DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt", pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
	return pBrushClone
}
Set_Mouse_Delay(){
	GuiControlGet,Mouse_Delay,3:,Mouse_Delay
}
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
}
Set_Target_Window(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	While(!GetKeyState("LButton"))
		ToolTip,Click on the target window to set it.
	ToolTip,
	WinGetTitle,Target_Window,A
	GuiControl,1:,Target_Window,% Target_Window
}
Gdip_SetStringFormatAlign(hFormat, Align){
   return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" : "UInt", hFormat, "int", Align)
}
Gdip_StringFormatCreate(Format=0, Lang=0){
   DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, A_PtrSize ? "UPtr*" : "UInt*", hFormat)
   return hFormat
}
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
}
Set_Box(){
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	GuiControlGet,Box_Width,1:,Box_Width
	GuiControlGet,Box_Height,1:,Box_Height
}
Gdip_CreatePen(ARGB, w){
   DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
   return pPen
}
Gdip_CreatePenFromBrush(pBrush, w){
	DllCall("gdiplus\GdipCreatePen2", A_PtrSize ? "UPtr" : "UInt", pBrush, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
	return pPen
}
Gdip_BrushCreateSolid(ARGB=0xff000000){
	DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
	return pBrush
}
Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0){
	DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "UInt", ARGBfront, "UInt", ARGBback, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
	return pBrush
}
Set_Click_Position(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	While(!GetKeyState("LButton"))
		Tooltip,Click somewhere to set click position
	ToolTip,
	MouseGetPos,Click_X,Click_Y
	GuiControl,1:,Click_Position,% "x: " Click_X "  y: " Click_Y
}
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")
}
Set_Click_Delay(){
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	GuiControlGet,Click_Delay,1:,Click_Delay
}
Gdip_SetTextRenderingHint(pGraphics, RenderingHint){
	return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", RenderingHint)
}
View_Click_Box(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	stop:=1
	if(!Click_X||!Click_Y||!Box_Width||!Box_Height){
		if(Sounds)
			loop 2
				SoundBeep, 400
		Gui,1:+OwnDialogs
		MsgBox,,Set Click Position,Set the click position.
		return
	}
	Gui,2:Destroy
	Gui,1:Minimize
	Gui,2:+AlwaysOnTop -DPIScale -Caption +LastFound +ToolWindow
	WinSet,Transparent,120
	Gui,2:Color,00ff00
	x:=Click_X-(Box_Width/2),y:=Click_Y-(Box_Height/2)
	Gui,2:Show,x%x% y%y% w%Box_Width% h%Box_Height% NA
	Sleep,2000
	Gui,2:Destroy
	Gui,1:Show
	if(WinActive("Ahk_Id" windowhwnd)){
		BitBlt(Main.hdc1 , 0, 0, Main.W, Main.H, Main.hdc2 ,0, 0) 
		loop 5
			GuiControl,1:+Redraw,Edit%A_Index%
	}
}
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
}
Stop(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	Stop:=1
	if(Sounds)
		loop 2
			SoundBeep, 400
}
CreateRect(ByRef Rect, x, y, w, h){
	VarSetCapacity(Rect, 16)
	NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w, Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
}
CreateSizeF(ByRef SizeF, w, h){
   VarSetCapacity(SizeF, 8)
   NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")     
}
CreatePointF(ByRef PointF, x, y){
   VarSetCapacity(PointF, 8)
   NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")     
}
Start(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	Stop:=0
	if(Use_Target_Window&&!Target_Window){
		if(Stop=0&&Sounds)
			loop 2
				SoundBeep, 400
		Gui,1:+OwnDialogs
		MsgBox,,Set Target Window,Set the target window `nor turn off "Use Target Window".
		Stop:=1
		return
	}else if(!Click_X||!Click_Y){
		if(Stop=0&&Sounds)
			loop 2
				SoundBeep, 400
		Gui,1:+OwnDialogs
		MsgBox,,Set Click Position,Set the click position.
		Stop:=1
		return
	}
	x1:=Click_X-(Box_Width/2),x2:=Click_X+(Box_Width/2)
	y1:=Click_Y-(Box_Height/2),y2:=Click_Y+(Box_Height/2)
	if(Sounds)
		Loop 3
			SoundBeep,% 400 + A_Index*100
	if(Use_Click_Delay&&Use_Target_Window)
		Click_W_Delay_N_Win_Func(x1,x2,y1,y2)
	else if(Use_Click_Delay)
		Click_W_Delay_Only_Func(x1,x2,y1,y2)
	else if(Use_Target_Window)
		Click_W_Target_Win_Only(x1,x2,y1,y2)
	else
		Click_AnyWin_Fast(x1,x2,y1,y2)
	SetBatchLines,10ms
}
Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("gdiplus\GdipDrawArc", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
}
Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("gdiplus\GdipDrawPie", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
}
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_DrawLines(pGraphics, pPen, Points){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	StringSplit, Points, Points, |
	VarSetCapacity(PointF, 8*Points0)   
	Loop, %Points0%
	{
		StringSplit, Coord, Points%A_Index%, `,
		NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
	}
	return DllCall("gdiplus\GdipDrawLines", Ptr, pGraphics, Ptr, pPen, Ptr, &PointF, "int", Points0)
}
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_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
}
Click_W_Delay_N_Win_Func(x1,x2,y1,y2){
	if(Turbo_Mode)
		SetBatchLines,-1
	else
		SetBatchLines,10ms
	SetMouseDelay,Mouse_Delay
	While(!Stop){
		MouseGetPos,x,y
		if(WinActive(Target_Window)&&x>x1&&x<x2&&y>y1&&y<y2){
			Click,%Click_X%,%Click_Y%
		}
		Sleep,Click_Delay
	}
}
Gdip_GetClipRegion(pGraphics){
	Region := Gdip_CreateRegion()
	DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
	return Region
}
Click_W_Delay_Only_Func(x1,x2,y1,y2){
	if(Turbo_Mode)
		SetBatchLines,-1
	else
		SetBatchLines,10ms
	SetMouseDelay,Mouse_Delay
	While(!Stop){
		MouseGetPos,x,y
		if(x>x1&&x<x2&&y>y1&&y<y2){
			Click,%Click_X%,%Click_Y%
		}
		Sleep,Click_Delay
	}
}
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_SetClipPath(pGraphics, Path, CombineMode=0){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("gdiplus\GdipSetClipPath", Ptr, pGraphics, Ptr, Path, "int", CombineMode)
}
Gdip_ResetClip(pGraphics){
   return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Click_W_Target_Win_Only(x1,x2,y1,y2){
	if(Turbo_Mode)
		SetBatchLines,-1
	else
		SetBatchLines,10ms
	SetMouseDelay,Mouse_Delay
	While(!Stop){
		MouseGetPos,x,y
		if(WinActive(Target_Window)&&x>x1&&x<x2&&y>y1&&y<y2){
			Click,%Click_X%,%Click_Y%
		}
	}
}
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_FillRegion(pGraphics, pBrush, Region){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("gdiplus\GdipFillRegion", Ptr, pGraphics, Ptr, pBrush, Ptr, Region)
}
Gdip_FillPath(pGraphics, pBrush, Path){
	Ptr := A_PtrSize ? "UPtr" : "UInt"
	return DllCall("gdiplus\GdipFillPath", Ptr, pGraphics, Ptr, pBrush, Ptr, Path)
}
Click_AnyWin_Fast(x1,x2,y1,y2){
	if(Turbo_Mode)
		SetBatchLines,-1
	else
		SetBatchLines,10ms
	SetMouseDelay,Mouse_Delay
	While(!Stop){
		MouseGetPos,x,y
		if(x>x1&&x<x2&&y>y1&&y<y2){
			Click,%Click_X%,%Click_Y%
		}
	}
}
Gdip_CreateRegion(){
	DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
	return Region
}
Gdip_DeleteRegion(Region){
	return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" : "UInt", Region)
}
Watch_Hover(){
	Static Index,lctrl,Hover_On
	MouseGetPos,,,,ctrl,2
	GuiControlGet,cName,1:Name,%ctrl%
	if(!Hover_On&&ctrl){
		loop,% Button.Length()	{
			if(cName=Button[A_Index].Name){
				Button[A_Index].Draw_Hover()
				lctrl:=ctrl,Index:=A_Index,Hover_On:=1
				break
			}
		}
	}else if(Hover_On=1){
		if((!ctrl||lctrl!=ctrl)&&Button[Index].isPressed=0){
			Button[Index].Draw_Default()
			Hover_On:=0
		}
	}
}
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
}
Watch2(){
	Static Index,lctrl,Hover_On
	MouseGetPos,,,,ctrl,2
	GuiControlGet,cName,3:Name,%ctrl%
	if(!Hover_On&&ctrl){
		loop,% Button.Length()	{
			if(cName=Button[A_Index].Name){
				Button[A_Index].Draw_Hover()
				lctrl:=ctrl,Index:=A_Index,Hover_On:=1
				break
			}
		}
	}else if(Hover_On=1){
		if((!ctrl||lctrl!=ctrl)&&Button[Index].isPressed=0){
			Button[Index].Draw_Default()
			Hover_On:=0
		}
	}
}
Gdip_SetSmoothingMode(pGraphics, SmoothingMode){
   return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", SmoothingMode)
}
Launch_Settings_Window(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	if(Stop=0&&Sounds)
		loop 2
			SoundBeep, 400
	Stop:=1
	Gui,3:Destroy
	SetTimer,Watch_Hover,Off
	Gui,3:+AlwaysOnTop -Caption -DPIScale +Owner1 +ToolWindow +LastFound
	Gui,1: +Disabled
	Gui,3:Color,1C2125,2c3136
	Gui,3:Font,c4477AA s8 Bold,Segoe UI
	Main.HWND2:= WinExist(),Main.hdc3:= GetDC(Main.HWND2)
	Main.hdc4:=CreateCompatibleDC()
	Main.hbm3:=CreateDIBSection(350,200),Main.obm3:= SelectObject(Main.hdc4,Main.hbm3),Main.G2:= Gdip_GraphicsFromHDC(Main.hdc4)
	Gui,3:Show,w350 h200,Smart Clicker Settings Window
	
	Gui,3:Add,Text,x255 y94 w79 h22 BackgroundTrans gUse_Sounds_Func
	Gdip_DrawImage( Main.G2, Settings_Window_Background(), 0, 0, 350, 200) 
	Gdip_DrawImage( Main.G2,(Sounds)?(Switch_On()):(Switch_Off()), 265, 94, 59, 22)
	
	Button.Push(New Button_Type1(x:=80,y:=145,w:=190,h:=40,"OK",FontSize:=16,Button.Length()+1,"Exit_Settings","3",Color:="0xFF0066AA",set:=1))
	BitBlt(Main.hdc3 , 0, 0, 350,200 , Main.hdc4 ,0, 0) 
	Gui,3:Add,Edit,x121 y95 w70 h20 -E0x200 Center vMouse_Delay gSet_Mouse_Delay,% Mouse_Delay
	SetTimer,Watch2,50
}
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_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_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)
}
Exit_Settings(){
	if(!Button[A_GuiControl].Draw_Pressed())
		return
	SetTimer,Watch2,Off
	Gui,3:Destroy
	Gui,1: -Disabled
	SetTimer,Watch_Hover,On
}
SetUp(){
	global
	Gui,1:+AlwaysOnTop +LastFound HwndWindowHwnd -Caption -DPIScale
	Gui,1:Color,1C2125,2c3136
	Gui,1:Font,c4477AA s8 Bold,Segoe UI
	Gui,1:Add,Text,x0 y0 w227 h27 BackgroundTrans  gMove_Window
	Gui,1:Add,Text,x280 y0 w35 h35 BackgroundTrans  gMin_Window
	Gui,1:Add,Text,x315 y0 w35 h35 BackgroundTrans  gGuiClose
	Main.Token:=Gdip_Startup(),Main.HWND:= WinExist(),Main.hdc1:= GetDC(Main.HWND),Main.hdc2:=CreateCompatibleDC()
	Main.hbm:=CreateDIBSection(Main.W,Main.H),Main.obm:= SelectObject(Main.hdc2,Main.hbm),Main.G:= Gdip_GraphicsFromHDC(Main.hdc2)
	Gdip_DrawImage( Main.G, Smart_Clicker_Background(), 0, 0, 350, 365),Gdip_DrawImage( Main.G, Switch_On(), 145, 50, 59, 22)
	Gui,1:Add,Text,x135 y50 w79 h22 BackgroundTrans  gUse_Target_Window_Func
	Button.Push(New Button_Type1(x:=38,y:=73,w:=130,h:=28,"Set Window",FontSize:=10,Button.Length()+1,"Set_Target_Window","1",Color:="0xFF0066AA"))
	Button.Push(New Button_Type1(x:=183,y,w,h,"Update Window",FontSize,Button.Length()+1,"Update_Target_Window","1",Color))
	Gdip_DrawImage( Main.G, Switch_On(), 145, 228, 59, 22)
	Gui,1:Add,Text,x135 y228 w79 h22 BackgroundTrans  gUse_Click_Delay_Func
	Gui,1:Add,Text,x135 y255 w79 h22 BackgroundTrans  gUse_Turbo_Mode_Func
	Gdip_TextToGraphics( Main.G , "Use Click Delay :" , "s10 Bold cFF000000 vcenter x24 y227" , "Segoe UI" , 170 , 22 )
	Gdip_TextToGraphics( Main.G , "Use Click Delay :" , "s10 Bold cFFaaaaaa vcenter x25 y228" , "Segoe UI" , 170 , 22 )
	Gdip_TextToGraphics( Main.G , "Turbo Mode :" , "s10 Bold cFF000000 vcenter x24 y254" , "Segoe UI" , 170 , 22 )
	Gdip_TextToGraphics( Main.G , "Turbo Mode :" , "s10 Bold cFFaaaaaa vcenter x25 y255" , "Segoe UI" , 170 , 22 )
	Gdip_DrawImage( Main.G, Switch_Off(), 145, 255, 59, 22)
	Button.Push(New Button_Type1(x:=180,y:=165,w:=140,h:=43,"View Box",FontSize,Button.Length()+1,"View_Click_Box","1",Color))
	Button.Push(New Button_Type1(x:=30,y:=137,w:=130,h:=28,"Set Position",FontSize,Button.Length()+1,"Set_Click_Position","1",Color))
	Gdip_TextToGraphics( Main.G , "Box Width :" , "s10 Bold cFF000000 x24 y167" , "Segoe UI" , 70 , 20 )
	Gdip_TextToGraphics( Main.G , "Box Width :" , "s10 Bold cFFaaaaaa x25 y168" , "Segoe UI" , 70 , 20 )
	Gdip_TextToGraphics( Main.G , "Box Height :" , "s10 Bold cFF000000 x24 y189" , "Segoe UI" , 70 , 20 )
	Gdip_TextToGraphics( Main.G , "Box Height :" , "s10 Bold cFFaaaaaa x25 y190" , "Segoe UI" , 70 , 20 )
	Brush := Gdip_CreateLineBrushFromRect( 95 , 165 , 70 , 20 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRectangle( Main.G , Brush , 95 , 165 , 72 , 20 )
	Brush := Gdip_CreateLineBrushFromRect( 95 , 185 , 70 , 20 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRectangle( Main.G , Brush , 95 , 187 , 72 , 20 )
	Brush := Gdip_CreateLineBrushFromRect( 195 , 141 , 102 , 22 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRectangle( Main.G , Brush , 195 , 141 , 102 , 22 ),Gdip_DeleteBrush( Brush )
	Gdip_TextToGraphics( Main.G , "Click Delay( ms )" , "s10 Bold cFF000000 x229 y234" , "Segoe UI" , 110 , 20 )
	Gdip_TextToGraphics( Main.G , "Click Delay( ms )" , "s10 Bold cFFaaaaaa x230 y235" , "Segoe UI" , 110 , 20 )
	Brush := Gdip_CreateLineBrushFromRect( 230 , 255 , 82 , 22 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRectangle( Main.G , Brush ,  230 , 255 , 82 , 22 ),Gdip_DeleteBrush( Brush )
	Button.Push(New Button_Type1(x:=30,y:=291,w:=145,h:=28,"Settings / Info",FontSize:=10,Button.Length()+1,"Launch_Settings_Window","1",Color))
	Button.Push(New Button_Type1(x+=w,y,w,h,"More Auto Clickers",FontSize:=10,Button.Length()+1,"Get_More_Clickers","1",Color))
	Button.Push(New Button_Type1(x:=10,y:=315,w:=110,h:=40,"START",FontSize:=16,Button.Length()+1,"Start","1",Color))
	Button.Push(New Button_Type1(x+=w,y,w,h,"STOP",FontSize,Button.Length()+1,"Stop","1",Color))
	Button.Push(New Button_Type1(x+=w,y,w,h,"RELOAD",FontSize,Button.Length()+1,"Reload","1",Color))
	Gui,1:Show,w350 h365 NA,Smart Click v1.2.2
	BitBlt(Main.hdc1 , 0, 0, 350,365 , Main.hdc2 ,0, 0) 
	Gui,1:Add,Edit,x29 y105 w293 h20 -E0x200 Center vTarget_Window,% Target_Window
	Gui,1:Add,Edit,x96 y166 w70 h18 -E0x200 Center Limit3 vBox_Width gSet_Box,80
	Gui,1:Add,Edit,x96 y188 w70 h18 -E0x200 Center Limit3 vBox_Height gSet_Box,80
	Gui,1:Add,Edit,x196 y142 w100 h20 -E0x200 Center vClick_Position,% "x: " Click_X "  y: " Click_Y
	Gui,1:Add,Edit,x231 y256 w80 h20 -E0x200 Center vClick_Delay gSet_Click_Delay,30
	SetTimer,Watch_Hover,60
}
Settings_Window_Background(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap:=Gdip_CreateBitmap( 350 , 200 ) 
	 G := Gdip_GraphicsFromImage( pBitmap )
	Gdip_SetSmoothingMode( G , 4 )
	Brush := Gdip_CreateLineBrush( -286 , -113 , 356 , 227 , "0xFF777777" , "0xFF000000" , 1 )
	Gdip_FillRectangle( G , Brush , -1 , -1 , 352 , 202 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF111416" )
	Gdip_FillRectangle( G , Brush , 2 , 2 , 346 , 196 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 41 , 8 , 266 , 34 , "0xFF777777" , "0xFF111111" , 1 , 1 )
	Gdip_FillRoundedRectangle( G , Brush , 40 , 5 , 270 , 30 , 14 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF2C3135" )
	Gdip_FillRoundedRectangle( G , Brush , 42 , 7 , 266 , 26 , 12 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x42 y6" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x41 y6" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x43 y6" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x43 y7" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x41 y7" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x41 y8" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x42 y8" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter  c" Brush " x43 y8" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF114E80" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter c" Brush " x42 y7" , "Impact" , 266 , 26 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
	Gdip_FillRectangle( G , Brush , 10 , 40 , 330 , 150 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 10 , 40 , 330 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 10 , 190 , 330 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 10 , 40 , 1 , 150 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 340 , 40 , 1 , 150 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRoundedRectangle( G , Brush , 20 , 45 , 310 , 42 , 14 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF2C3135" )
	Gdip_FillRoundedRectangle( G , Brush , 21 , 46 , 308 , 40 , 14 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFaaaaaa" )
	Gdip_TextToGraphics( G , "Created By: Hellbent aka CivReborn" , "s10 Center vCenter c" Brush " x21 y36" , "Segoe UI" , 308 , 48 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFaaaaaa" )
	Gdip_TextToGraphics( G , "Date: March 14th, 2019" , "s10 Center vCenter c" Brush " x21 y51" , "Segoe UI" , 308 , 48 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFbbbbbb" )
	Gdip_TextToGraphics( G , "SetMouseDelay:" , "s12  Bold  c" Brush " x21 y97" , "Segoe UI" , 100 , 20 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 120 , 94 , 72 , 22 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRectangle( G , Brush , 120 , 94 , 72 , 22 )
	Gdip_DeleteBrush( Brush )
	;~ Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	;~ Gdip_FillRectangle( G , Brush , 121 , 95 , 70 , 20 )
	;~ Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFbbbbbb" )
	Gdip_TextToGraphics( G , "Sounds:" , "s12  Bold  c" Brush " x211 y97" , "Segoe UI" , 100 , 20 )
	Gdip_DeleteBrush( Brush )
	;~ Brush := Gdip_CreateLineBrushFromRect( 202 , 103 , 69 , 22 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	;~ Gdip_FillRectangle( G , Brush , 260 , 94 , 59 , 22 )
	;~ Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFbbbbbb" )
	Gdip_TextToGraphics( G , "Stop Hotkey:     ESC" , "s12  Bold Center c" Brush " x0 y125" , "Segoe UI" , 350 , 20 )
	Gdip_DeleteBrush( Brush )
	;~ Brush := Gdip_BrushCreateSolid( "0xFFFF0000" )
	;~ Gdip_FillRectangle( G , Brush , 80 , 145 , 190 , 40 )
	;~ Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
Switch_On(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap:=Gdip_CreateBitmap( 59 , 22 ) 
	 G := Gdip_GraphicsFromImage( pBitmap )
	Gdip_SetSmoothingMode( G , 4 )
	Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
	Gdip_FillRectangle( G , Brush , -1 , -1 , 60 , 30 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF555555" )
	Gdip_FillRoundedRectangle( G , Brush , 1 , 3 , 56 , 17 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRoundedRectangle( G , Brush , 2 , 4 , 54 , 15 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF262626" )
	Gdip_FillRoundedRectangle( G , Brush , 3 , 5 , 52 , 13 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 25 , 2 , 31 , 19 , "0xFF333333" , "0xFF000000" , 1 , 1 )
	Gdip_FillRoundedRectangle( G , Brush , 27 , 5 , 28 , 13 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 26 , 2 , 29 , 19 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRoundedRectangle( G , Brush , 28 , 6 , 26 , 11 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 36 , 11 , 2 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 40 , 11 , 2 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 44 , 11 , 2 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF959595" )
	Gdip_TextToGraphics( G , "ON" , "s8 Center vCenter Bold c" Brush " x-13 y1" , "Segoe UI" , 59 , 22 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF888888" )
	Gdip_FillRectangle( G , Brush , 32 , 8 , 18 , 1 )
	Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
Switch_Off(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap:=Gdip_CreateBitmap( 59 , 22 ) 
	 G := Gdip_GraphicsFromImage( pBitmap )
	Gdip_SetSmoothingMode( G , 4 )
	Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
	Gdip_FillRectangle( G , Brush , -1 , -1 , 60 , 30 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF555555" )
	Gdip_FillRoundedRectangle( G , Brush , 1 , 3 , 56 , 17 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRoundedRectangle( G , Brush , 2 , 4 , 54 , 15 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF262626" )
	Gdip_FillRoundedRectangle( G , Brush , 3 , 5 , 52 , 13 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 25 , 2 , 31 , 19 , "0xFF333333" , "0xFF000000" , 1 , 1 )
	Gdip_FillRoundedRectangle( G , Brush , 3 , 5 , 28 , 13 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 26 , 2 , 29 , 19 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRoundedRectangle( G , Brush , 4 , 6 , 26 , 11 , 5 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 12 , 11 , 2 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 16 , 11 , 2 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 20 , 11 , 2 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF959595" )
	Gdip_TextToGraphics( G , "OFF" , "s8 Center vCenter Bold c" Brush " x13 y1" , "Segoe UI" , 59 , 22 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF888888" )
	Gdip_FillRectangle( G , Brush , 8 , 8 , 18 , 1 )
	Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
Smart_Clicker_Background(){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap:=Gdip_CreateBitmap( 350 , 365 ) 
	 G := Gdip_GraphicsFromImage( pBitmap )
	Gdip_SetSmoothingMode( G , 4 )
	Brush := Gdip_CreateLineBrush( -27 , -19 , 359 , 366 , "0xFF1C2125" , "0xFF000000" , 1 )
	Gdip_FillRectangle( G , Brush , -1 , -1 , 352 , 367 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrush( 15 , 5 , 15 , 36 , "0xFFAAAAAA" , "0xFF000000" , 1 )
	Gdip_FillRoundedRectangle(G , Brush , 15 , 5 , 200 , 30 , 10 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF2C3135" )
	Gdip_FillRoundedRectangle(G , Brush , 16 , 6 , 198 , 27 , 10 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
	Gdip_FillRectangle( G , Brush , 7 , 40 , 335 , 318 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrush( -3 , -4 , 297 , 368 , "0xFF777777" , "0xFF000000" , 1 )
	Pen := Gdip_CreatePenFromBrush( Brush , 2 )
	Gdip_DeleteBrush( Brush )
	Gdip_DrawRectangle( G , Pen , 0 , 0 , 349 , 364 )
	Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrush( -226 , -62 , 276 , 374 , "0xFF777777" , "0xFF000000" , 1 )
	Pen := Gdip_CreatePenFromBrush( Brush , 2 )
	Gdip_DeleteBrush( Brush )
	Gdip_DrawRectangle( G , Pen , 6 , 40 , 337 , 318 )
	Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 6 , 39 , 2 , 319 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 342 , 39 , 2 , 319 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 6 , 39 , 336 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 6 , 357 , 337 , 2 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter c" Brush " x32 y8" , "Impact" , 178 , 28 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0x33ffffff" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter c" Brush " x30 y7" , "Impact" , 178 , 28 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xaa005BA7" )
	Gdip_TextToGraphics( G , "Smart Clicker" , "s16 Center vCenter c" Brush " x31 y7" , "Impact" , 178 , 28 )
	Gdip_TextToGraphics( G , "v1.2.2" , "s6 Center vCenter c" Brush " x141 y17" , "Impact" , 178 , 28 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "__" , "s16 Center vCenter Bold Underline c" Brush " x280 y-4" , "Segoe UI" , 50 , 50 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF999999" )
	Gdip_TextToGraphics( G , "__" , "s16 Center vCenter Bold Underline c" Brush " x279 y-5" , "Segoe UI" , 50 , 50 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "X" , "s18 Center vCenter Bold c" Brush " x308 y0" , "Segoe UI" , 50 , 50 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrush( 325 , 6 , 335 , 28 , "0xFF999999" , "0xFF444444" , 1 )
	Gdip_TextToGraphics( G , "X" , "s18 Center vCenter Bold c" Brush " x307 y-1" , "Segoe UI" , 50 , 50 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
	Gdip_FillRectangle( G , Brush , 16 , 44 , 319 , 85 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 16 , 44 , 319 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 16 , 128 , 319 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 16 , 44 , 1 , 84 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 334 , 44 , 1 , 85 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
	Gdip_FillRectangle( G , Brush , 16 , 135 , 319 , 75 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 16 , 135 , 319 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 16 , 209 , 319 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 16 , 135 , 1 , 74 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 334 , 135 , 1 , 75 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
	Gdip_FillRectangle( G , Brush , 16 , 219 , 319 , 70 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 16 , 219 , 319 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 16 , 289 , 319 , 1 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_FillRectangle( G , Brush , 334 , 219 , 1 , 70 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF777777" )
	Gdip_FillRectangle( G , Brush , 16 , 219 , 1 , 70 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" )
	Gdip_TextToGraphics( G , "Use Target Window :" , "s10 Center vCenter Bold c" Brush " x11 y50" , "Segoe UI" , 140 , 22 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFFaaaaaa" )
	Gdip_TextToGraphics( G , "Use Target Window :" , "s10 Center vCenter Bold c" Brush " x10 y51" , "Segoe UI" , 140 , 22 )
	Gdip_DeleteBrush( Brush )
	Brush := Gdip_CreateLineBrushFromRect( 28 , 104 , 295 , 22 , "0xFF777777" , "0xFF000000" , 1 , 1 )
	Gdip_FillRectangle( G , Brush , 28 , 104 , 295 , 22 )
	Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}
class Button_Type1	{
	__New(x,y,w,h,text,FontSize,name,label,Window,Color:="0xFF3399FF",Set:=0){
		This.X:=X,This.Y:=Y,This.W:=W,This.H:=H,This.FontSize:=FontSize,This.Text:=Text,This.Name:=Name,This.Label:=Label,This.Color:=Color,This.Window:=Window,This.isPressed:=0,This.Set:=Set
		This.Default_Bitmap:=This.Create_Default_Button(),This.Hover_Bitmap:=This.Create_Hover_Button(),This.Pressed_Bitmap:=This.Create_Pressed_Button(),This.Add_Trigger(),This.Draw_Default()
	}
	Add_Trigger(){
		global
		Gui,% This.Window ":Add",Text,% "x" This.X " y" This.Y " w" This.W " h" This.H " v" This.Name " g" This.Label
	}
	Create_Default_Button(){
		;Bitmap Created Using: HB Bitmap Maker
		pBitmap:=Gdip_CreateBitmap( This.W , This.H ) 
		 G := Gdip_GraphicsFromImage( pBitmap )
		Gdip_SetSmoothingMode( G , 2 )
		Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
		Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_BrushCreateSolid( "0xFF060B0F" )
		Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-7 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_BrushCreateSolid( "0xFF262B2F" )
		Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , This.W-7 , This.H-9 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W , This.H-10 , "0xFF3F444A" , "0xFF24292D" , 1 , 1 )
		Gdip_FillRoundedRectangle( G , Brush , 4 , 5 , This.W-9 , This.H-11 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_BrushCreateSolid( "0xFF272C32" )
		Gdip_FillRoundedRectangle( G , Brush , 5 , 7 , This.W-11 , This.H-14 , 5 )
		Gdip_DeleteBrush( Brush )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter caaF0F0F0 x0 y1" , "Segoe UI" , This.W , This.H )
		Gdip_DeleteGraphics( G )
		return pBitmap
	}
	Create_Hover_Button(){
		;Bitmap Created Using: HB Bitmap Maker
		pBitmap:=Gdip_CreateBitmap( This.W , This.H ) 
		 G := Gdip_GraphicsFromImage( pBitmap )
		Gdip_SetSmoothingMode( G , 2 )
		Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
		Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_BrushCreateSolid( "0xFF151A20" )
		Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-7 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_BrushCreateSolid( "0xFF2B3036" )
		Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , This.W-7 , This.H-9 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W , This.H-10 , "0xFF464D55" , "0xFF1E2329" , 1 , 1 )
		Gdip_FillRoundedRectangle( G , Brush , 4 , 5 , This.W-9 , This.H-11 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W-30 , This.H+21 , "0xFF2D343C" , This.Color , 1 , 1 )
		Gdip_FillRoundedRectangle( G , Brush , 4 , 7 , This.W-9 , This.H-13 , 5 )
		Gdip_DeleteBrush( Brush )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x-1 y2" , "Segoe UI" , This.W , This.H )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x-1 y1" , "Segoe UI" , This.W , This.H )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x-1 y0" , "Segoe UI" , This.W , This.H )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x0 y0" , "Segoe UI" , This.W , This.H )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x1 y2" , "Segoe UI" , This.W , This.H )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x1 y1" , "Segoe UI" , This.W , This.H )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter caaF0F0F0 x0 y1" , "Segoe UI" , This.W , This.H )
		Gdip_DeleteGraphics( G )
		return pBitmap
	}
	Create_Pressed_Button(){
		;Bitmap Created Using: HB Bitmap Maker
		pBitmap:=Gdip_CreateBitmap( This.W , This.H ) 
		 G := Gdip_GraphicsFromImage( pBitmap )
		Gdip_SetSmoothingMode( G , 4 )
		Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
		Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_BrushCreateSolid( "0xFF31363B" )
		Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-6 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W , This.H , "0xFF151A20" , "0xFF151A20" , 1 , 1 )
		Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-8 , 5 )
		Gdip_DeleteBrush( Brush )
		Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W-7 , This.H-10 , "0xFF22272D" , "0xFF33383E" , 1 , 1 )
		Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , This.W-7 , This.H-10 , 5 )
		Gdip_DeleteBrush( Brush )
		Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter caaF0F0F0 x0 y0" , "Segoe UI" , This.W , This.H )
		Gdip_DeleteGraphics( G )
		return pBitmap
	}
	Draw_Default(){
		if(This.Set=1){
			Gdip_DrawImage( Main.G2, This.Default_Bitmap, This.X, This.Y, This.W, This.H)
			BitBlt(Main.hdc3 , This.X, This.Y, This.W, This.H, Main.hdc4 ,This.X, This.Y) 
		}else	{
			Gdip_DrawImage( Main.G, This.Default_Bitmap, This.X, This.Y, This.W, This.H)
			BitBlt(Main.hdc1 , This.X, This.Y, This.W, This.H, Main.hdc2 ,This.X, This.Y) 
			
		}
	}
	Draw_Hover(){
		if(This.Set=1){
			Gdip_DrawImage( Main.G2, This.Hover_Bitmap, This.X, This.Y, This.W, This.H)
			BitBlt(Main.hdc3 , This.X, This.Y, This.W, This.H, Main.hdc4 ,This.X, This.Y) 
		}else	{
			Gdip_DrawImage( Main.G, This.Hover_Bitmap, This.X, This.Y, This.W, This.H)
			BitBlt(Main.hdc1 , This.X, This.Y, This.W, This.H, Main.hdc2 ,This.X, This.Y)
		}
	}
	Draw_Pressed(){
		if(This.Set=1){
			Gdip_DrawImage( Main.G2, This.Pressed_Bitmap, This.X, This.Y, This.W, This.H)
			BitBlt(Main.hdc3 , This.X, This.Y, This.W, This.H, Main.hdc4 ,This.X, This.Y) 
		}else	{
			Gdip_DrawImage( Main.G, This.Pressed_Bitmap, This.X, This.Y, This.W, This.H)
			BitBlt(Main.hdc1 , This.X, This.Y, This.W, This.H, Main.hdc2 ,This.X, This.Y) 
		}
		This.isPressed:=1
		While(GetKeyState("LButton"))
			sleep,10
		This.isPressed:=0
		MouseGetPos,,,,ctrl,2
		if(This.Set=1)
			GuiControlGet,cName,3:Name,%ctrl%
		else
			GuiControlGet,cName,1:Name,%ctrl%
		if(cName!=This.Name){
			This.Draw_Default()
			return false
		}else	{
			This.Draw_Hover()
			return true
		}
	}
}
#If (Stop=0)
*Esc::
	If(Sounds)
		Loop,2
			SoundBeep,400
		Stop:=1
	return
#If

I just want to know- is there any kind of command, function or any utility which creates such kind of effect in gui buttons?

Please help and guide. thanks a lot...

Thanks a lot...
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

Re: How to change the color and font of a GUI button when I hover mouse pointer over it?

03 May 2019, 13:21

Is there any help regarding it? What is gdip and Bitmap which are used again and again in above codes? please tell...
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
garry
Posts: 1871
Joined: 22 Dec 2013, 12:50

Re: How to change the color and font of a GUI button when I hover mouse pointer over it?

04 May 2019, 01:56

have no answer for GDIP
here just an example with 2 Buttons, if hover then CHANGE FONT
( GUI example for different screensize , not needed here )

Code: Select all

#warn
SetWorkingDir, %A_ScriptDir%
wa:=A_screenwidth
ha:=A_screenHeight
Gui,2:-border
Gui,2: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,2:Color,Black,Black
Gui,2:Font,s13 cGray,Lucida Console
xx:=100
w:=wa*8/xx, h:=ha*2.8/xx ,dw:=wa*1/xx, dh:=ha*1/xx
x1:=(wa*2)/xx, y1:=ha*1/xx
Gui,2:add,button,x%x1% y%y1% w%w% h%h%            gA1 ,Button-A
x2:=(wa*2)/xx, y2:=ha*5/xx
Gui,2:add,button,x%x2% y%y2% w%w% h%h%   vButtonB gA2 ,Button-B
x :=(wa*10)/xx, y:=ha*10/xx , gw:=wa*25/xx, gh:=ha*20/xx
Gui,2:show,x%x% y%y% w%gw% h%gh%,Hover_Test
OnMessage(0x200, "WM_MOUSEMOVE")
return
;----------------
esc::exitapp
;-------------------------------------------------------------------------------
WM_MOUSEMOVE(wParam, lParam, msg, hwnd) {
	static prev := ""
	MouseGetPos positionX, positionY, hoveredWindow, curr, 
	if(prev != curr) {
		if(prev) {
            Gui,2:Font,s13,Lucida Console
	        Gui,2: font,norm,
	        guicontrol,2:font, %prev%
			prev := ""
		}
		if(curr) {
            Gui,2:Font,s13 ,Courier new
	        Gui,2: font,italic,
	        guicontrol,2:font, %curr%
			prev := curr
		}
	}
}

;----------------
a1:
Gui,2:submit,nohide
r:= a_guicontrol          ;- vVar ( Buttonname )
Mousegetpos,,,,Control      
msgbox, 262208,A ,Clicked Button =%r%`n CTRL=%control%,2
return
;----------------
a2:
Gui,2:submit,nohide
r:= a_guicontrol          ;- vVar ( Buttonname )
Mousegetpos,,,,Control      
msgbox, 262208,B ,Clicked Button =%r%`n CTRL=%control%,2
return
;===================== end script ========================

Example for COLOR BUTTONs

Code: Select all

#Warn
#NoEnv
SendMode,Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode,2
SetBatchLines, -1
FileEncoding, UTF-8
Gui,2:default
Gui,2: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,2:Font,s14 , Verdana
Gui,2:Color,Gray,Black

WinGetPos, TTX, TTY, TTW, TrayHeight, ahk_class Shell_TrayWnd,,,
HA    :=(A_screenheight-TrayHeight)
WA    :=(A_screenwidth)

xx:=100.4
GW    :=(WA*99.9)/xx      ;- width    Gui Width
GH    :=(HA*99  )/xx      ;- height   Gui Height

;------------- example some color buttons -----------
i=0
y   :=(ha*1.01)/xx
x   :=(wa*1.66)/xx
LY1 :=(HA*95  )/xx
w   :=(wa*5   )/xx
h   :=(ha*2.5 )/xx
sect1=Check-XY,Default,YT_SIZE,LAST,QUIT,Youtube,Archive,NL_Archive,UK_Pathe,PT_Oldies,NL_Lubach,US_Oldies,RU_Masha
sect=%sect1%
stringsplit,k,sect,`,
           total:=k0
Gui,2:add,text,section x%x% y%ly1% w0 h0,
 Loop,%total%
    {
    i++
    ck:=k%a_index%
    Gui,2:Add,Progress, x+15   y%ly1% w%w% h%h%  Disabled BackgroundBlue
    if (i>5)
      Gui,2:Add,Text,     xp   yp  wp  hp   cGray    BackgroundTrans Center 0x200 gStart2 ,%ck%
    else
      Gui,2:Add,Text,     xp   yp  wp  hp   cYellow  BackgroundTrans Center 0x200 gStart2 ,%ck%
    }
;---------------------------------------------------

gui,2:show, x0 y0 h%gh% w%gw%,MENU %a_osversion% | %a_ostype% | 64bit=%a_is64bitos% | %wa%*%ha% | %a_username%=%a_isadmin% | %a_computername%
return

Quit:
2GuiEscape:
2GuiClose:
exitapp

Start2:
gui,2:submit,nohide
r:= a_guicontrol
goto,%r%
return

Check-XY:
Default:
YT_SIZE:
LAST:
Youtube:
Archive:
NL_Archive:
UK_Pathe:
PT_Oldies:
NL_Lubach:
US_Oldies:
RU_Masha:
msgbox, 262208,BUTTON-TEST ,%r%,2
return
;=========================================================================
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

Re: How to change the color and font of a GUI button when I hover mouse pointer over it?

07 May 2019, 13:22

just me wrote:
04 May 2019, 04:07
[Class] ImageButton

Thanks dear just me... Your this button class really helped me to create custom buttons. You are really great and awesome!!!!!

Dear just me, is there any such kind of class or function by using that i can create custom edit boxes, radio buttons, check boxes, list view, progress bar, text etc in GUI? Please tell and guide. Thank you dear just me... :clap: :salute:
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

Re: How to change the color and font of a GUI button when I hover mouse pointer over it?

10 May 2019, 13:59

garry wrote:
04 May 2019, 01:56
have no answer for GDIP
here just an example with 2 Buttons, if hover then CHANGE FONT
( GUI example for different screensize , not needed here )

Code: Select all

#warn
SetWorkingDir, %A_ScriptDir%
wa:=A_screenwidth
ha:=A_screenHeight
Gui,2:-border
Gui,2: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,2:Color,Black,Black
Gui,2:Font,s13 cGray,Lucida Console
xx:=100
w:=wa*8/xx, h:=ha*2.8/xx ,dw:=wa*1/xx, dh:=ha*1/xx
x1:=(wa*2)/xx, y1:=ha*1/xx
Gui,2:add,button,x%x1% y%y1% w%w% h%h%            gA1 ,Button-A
x2:=(wa*2)/xx, y2:=ha*5/xx
Gui,2:add,button,x%x2% y%y2% w%w% h%h%   vButtonB gA2 ,Button-B
x :=(wa*10)/xx, y:=ha*10/xx , gw:=wa*25/xx, gh:=ha*20/xx
Gui,2:show,x%x% y%y% w%gw% h%gh%,Hover_Test
OnMessage(0x200, "WM_MOUSEMOVE")
return
;----------------
esc::exitapp
;-------------------------------------------------------------------------------
WM_MOUSEMOVE(wParam, lParam, msg, hwnd) {
	static prev := ""
	MouseGetPos positionX, positionY, hoveredWindow, curr, 
	if(prev != curr) {
		if(prev) {
            Gui,2:Font,s13,Lucida Console
	        Gui,2: font,norm,
	        guicontrol,2:font, %prev%
			prev := ""
		}
		if(curr) {
            Gui,2:Font,s13 ,Courier new
	        Gui,2: font,italic,
	        guicontrol,2:font, %curr%
			prev := curr
		}
	}
}

;----------------
a1:
Gui,2:submit,nohide
r:= a_guicontrol          ;- vVar ( Buttonname )
Mousegetpos,,,,Control      
msgbox, 262208,A ,Clicked Button =%r%`n CTRL=%control%,2
return
;----------------
a2:
Gui,2:submit,nohide
r:= a_guicontrol          ;- vVar ( Buttonname )
Mousegetpos,,,,Control      
msgbox, 262208,B ,Clicked Button =%r%`n CTRL=%control%,2
return
;===================== end script ========================

Example for COLOR BUTTONs

Code: Select all

#Warn
#NoEnv
SendMode,Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode,2
SetBatchLines, -1
FileEncoding, UTF-8
Gui,2:default
Gui,2: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,2:Font,s14 , Verdana
Gui,2:Color,Gray,Black

WinGetPos, TTX, TTY, TTW, TrayHeight, ahk_class Shell_TrayWnd,,,
HA    :=(A_screenheight-TrayHeight)
WA    :=(A_screenwidth)

xx:=100.4
GW    :=(WA*99.9)/xx      ;- width    Gui Width
GH    :=(HA*99  )/xx      ;- height   Gui Height

;------------- example some color buttons -----------
i=0
y   :=(ha*1.01)/xx
x   :=(wa*1.66)/xx
LY1 :=(HA*95  )/xx
w   :=(wa*5   )/xx
h   :=(ha*2.5 )/xx
sect1=Check-XY,Default,YT_SIZE,LAST,QUIT,Youtube,Archive,NL_Archive,UK_Pathe,PT_Oldies,NL_Lubach,US_Oldies,RU_Masha
sect=%sect1%
stringsplit,k,sect,`,
           total:=k0
Gui,2:add,text,section x%x% y%ly1% w0 h0,
 Loop,%total%
    {
    i++
    ck:=k%a_index%
    Gui,2:Add,Progress, x+15   y%ly1% w%w% h%h%  Disabled BackgroundBlue
    if (i>5)
      Gui,2:Add,Text,     xp   yp  wp  hp   cGray    BackgroundTrans Center 0x200 gStart2 ,%ck%
    else
      Gui,2:Add,Text,     xp   yp  wp  hp   cYellow  BackgroundTrans Center 0x200 gStart2 ,%ck%
    }
;---------------------------------------------------

gui,2:show, x0 y0 h%gh% w%gw%,MENU %a_osversion% | %a_ostype% | 64bit=%a_is64bitos% | %wa%*%ha% | %a_username%=%a_isadmin% | %a_computername%
return

Quit:
2GuiEscape:
2GuiClose:
exitapp

Start2:
gui,2:submit,nohide
r:= a_guicontrol
goto,%r%
return

Check-XY:
Default:
YT_SIZE:
LAST:
Youtube:
Archive:
NL_Archive:
UK_Pathe:
PT_Oldies:
NL_Lubach:
US_Oldies:
RU_Masha:
msgbox, 262208,BUTTON-TEST ,%r%,2
return
;=========================================================================

Thanks dear garry for your kind support and for these outstanding codes... :clap: :clap:


Dear garry.. Could you please tell me how can I create custom (colorful) edit boxes, radio buttons, check boxes, list views? please help. Thanks garry....
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
garry
Posts: 1871
Joined: 22 Dec 2013, 12:50

Re: How to change the color and font of a GUI button when I hover mouse pointer over it?

10 May 2019, 15:16

have no experience
maybe ask again or advanced search in forum : script&functions , user='just me' , example search for Listview CLASS
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=1081&hilit=Listview+class
example user 'just me' and many others have knowledge , CLASS for different functions, like Listview rows color , different Edit colors etc

Return to “Ask For Help”

Who is online

Users browsing this forum: anaxio, Bing [Bot], broly, flyingDman, Google [Bot], yougone and 242 guests