Hello, I want add a rectangle in gui, this rectangle doesn't have filled color, the stroke is 2, stroke color is red
rectangle position and size x10 y10 w100 h80
How to do it ? Appreciate your help.
How to add a rectangle in gui without filled color Topic is solved
Re: How to add a rectangle in gui without filled color Topic is solved
Code: Select all
#Requires AutoHotkey v1.1.33
image := A_ScriptDir "\test2.gif"
Gui -DPIScale
Gui Margin, 10, 10
Gui Color, Yellow
Gui Add, Pic, AltSubmit, % image
Gui Show
- Attachments
-
- Test image
- test2.gif (310 Bytes) Viewed 552 times
Re: How to add a rectangle in gui without filled color
Hallo,
try:
try:
Code: Select all
Gui, 1:Show, w250 h150
xr := 10, yr := 10, wr := 100, hr := 80 ; rectangle
sr := 2 ; stroke of rectangle
Gui, r:+Parent1 -Caption +LastFound -SysMenu +ToolWindow
Gui, r:Color, Red
Gui, r:Show,% "w"wr " h"hr " x"xr " y"yr
WinSet, Region,% "0-0 "wr "-0 "wr "-"hr " 0-"hr " 0-0 "sr "
-"sr " "wr-sr "-"sr " "wr-sr "-"hr-sr " "sr "-"hr-sr " "sr "-"sr
Re: How to add a rectangle in gui without filled color
@Hellbent
What is the purpose of calculating x2 ?
Draw_Outline(Gui_Name,x,y,w,h,Color:="Black",thickness:=1){
x2:=X+W-thickness
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y " w" W " h" thickness " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y " w" thickness " h" H " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y+H-thickness " w" W " h" thickness " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X+W-thickness " y" Y " w" thickness " h" H " Background" Color
}
What is the purpose of calculating x2 ?
Draw_Outline(Gui_Name,x,y,w,h,Color:="Black",thickness:=1){
x2:=X+W-thickness
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y " w" W " h" thickness " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y " w" thickness " h" H " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y+H-thickness " w" W " h" thickness " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X+W-thickness " y" Y " w" thickness " h" H " Background" Color
}
Re: How to add a rectangle in gui without filled color
When I write code, I first think broadly about the problem and try to get a general sense of what I need to do, the steps I need to take, the variables I'm going to need, etc.
What you have there is likely a remnant of where planning meets writing. I have noticed that a few times now too (in regards to this code) and my best guess is that I left it there as a pointer to a later me that I might want to do it with new variables rather than have the calculation done in the controls options :shrug:
This is likely what I started out planning on doing but for whatever reason I changed my mind as I wrote the code.
Code: Select all
Draw_Outline(Gui_Name,x,y,w,h,Color:="Black",thickness:=1){
x2:=X+W-thickness
y2:=Y+H-thickness
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y " w" W " h" thickness " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X " y" Y " w" thickness " h" H " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" X " y" y2 " w" W " h" thickness " Background" Color
Gui,% Gui_Name ":Add",Progress,% "x" x2 " y" Y " w" thickness " h" H " Background" Color
}
It has no purpose.
In all honesty, It's not the first time that I have created variables that I don't end up using and it won't be the last lol.