Skip to content

Commit 869447a

Browse files
v2.3.5 : Minor Updates, Added Anchor and visible properties to controls
1 parent 553bfc9 commit 869447a

3 files changed

Lines changed: 324 additions & 267 deletions

File tree

EZCode/EZCode.cs

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class EzCode
2323
/// <summary>
2424
/// Directory of the script playing
2525
/// </summary>
26-
public static string Version { get; } = "2.3.3";
26+
public static string Version { get; } = "2.3.5";
2727

2828
#region Variables_and_Initializers
2929
/// <summary>
@@ -3915,6 +3915,12 @@ string ColonResponse(string value, string[] parts = null)
39153915
Control control = getControl(ind[0]);
39163916
switch (ind[1].ToLower())
39173917
{
3918+
case "visible":
3919+
value = control.Visible.ToString();
3920+
break;
3921+
case "anchor":
3922+
value = control.Anchor.ToString();
3923+
break;
39183924
case "align":
39193925
if (control is GLabel _glb1)
39203926
{
@@ -4593,14 +4599,16 @@ async Task<Control> Change(Control _control, string[] _parts, int index, bool te
45934599
multiline = control is GTextBox tb2 ? tb2.Multiline : false,
45944600
wordwrap = control is GTextBox tb3 ? tb3.Multiline : false,
45954601
enabled = control.Enabled,
4602+
visible = control.Visible,
45964603
autosize = control.AutoSize;
45974604
ScrollBars scrollbars = control is GTextBox tb4 ? tb4.ScrollBars : ScrollBars.None;
45984605
Font font = control.Font;
45994606
PointF[] _points = control is GShape gsa3 ? gsa3.Points : Array.Empty<PointF>();
4600-
ContentAlignment align =
4601-
align = control is GLabel lb1 ? lb1.TextAlign :
4607+
ContentAlignment align =
4608+
align = control is GLabel lb1 ? lb1.TextAlign :
46024609
align = control is GButton bt1 ? bt1.TextAlign :
46034610
ContentAlignment.TopLeft;
4611+
AnchorStyles anchor = control.Anchor;
46044612

46054613
foreach (string p in parts)
46064614
{
@@ -4935,6 +4943,51 @@ async Task<Control> Change(Control _control, string[] _parts, int index, bool te
49354943
}
49364944
}
49374945
break;
4946+
case "visible":
4947+
{
4948+
visible = (bool)BoolCheck(after, 0);
4949+
}
4950+
break;
4951+
case "anchor":
4952+
try
4953+
{
4954+
string[] strings = getString_value(after, 0);
4955+
string all = string.Join("", strings[0].Split(" ")).Trim();
4956+
bool thing2 = all.StartsWith("[") && all.EndsWith("]#suppresserror".ToLower());
4957+
if ((all.StartsWith("[") && all.EndsWith("]")) || thing2)
4958+
{
4959+
if (!thing2) all = all.Substring(1, all.Length - 2);
4960+
else all = all.Substring(1, all.Length - 1).Replace("]#suppresserror", "");
4961+
string[] seperator = all.Split(";").Select(x=>x.ToLower()).ToArray();
4962+
bool top = false, bottom = false, left = false, right = false;
4963+
for (int i = 0; i < seperator.Length; i++)
4964+
{
4965+
string sep = seperator[i];
4966+
switch (sep)
4967+
{
4968+
case "top": top = true; break;
4969+
case "bottom": bottom = true; break;
4970+
case "left": left = true; break;
4971+
case "right": right = true; break;
4972+
case "none": top = false; bottom = false; left = false; right = false; break;
4973+
default: ErrorText(parts, ErrorTypes.custom, custom: $"Expected 'top', 'bottom', 'left', 'right', or 'none' with anchor values"); break;
4974+
}
4975+
}
4976+
if (top) anchor |= AnchorStyles.Top;
4977+
if (bottom) anchor |= AnchorStyles.Bottom;
4978+
if (left) anchor |= AnchorStyles.Left;
4979+
if (right) anchor |= AnchorStyles.Right;
4980+
}
4981+
else
4982+
{
4983+
ErrorText(parts, ErrorTypes.custom, custom: $"Expected '[' and ']' to set anchor values");
4984+
}
4985+
}
4986+
catch
4987+
{
4988+
anchor = AnchorStyles.Top | AnchorStyles.Left;
4989+
}
4990+
break;
49384991
default:
49394992
ErrorText(_parts, ErrorTypes.custom, custom: $"'{before[0].Trim()}' is not a correct property for '{control.Name}'. Visit https://ez-code.web.app for more information about property values.");
49404993
break;
@@ -4954,6 +5007,9 @@ async Task<Control> Change(Control _control, string[] _parts, int index, bool te
49545007
control.Font = font;
49555008
control.AutoSize = autosize;
49565009
control.Text = textt;
5010+
control.Visible = visible;
5011+
control.Visible = visible;
5012+
control.Anchor = anchor;
49575013
if (control is GShape a1)
49585014
{
49595015
a1.Poly = ply;

EZCode/EZCode.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<ItemGroup>
4848
<Reference Include="System.Windows.Forms">
49-
<HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Windows.Forms.dll</HintPath>
49+
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Windows.Forms.dll</HintPath>
5050
</Reference>
5151
</ItemGroup>
5252

0 commit comments

Comments
 (0)