This commit is contained in:
pointfeev 2022-12-20 16:40:14 -05:00
parent 9736e6dc1d
commit f90975f606
3 changed files with 32 additions and 24 deletions

View file

@ -87,9 +87,9 @@ internal class CustomTreeView : TreeView
: ColorTranslator.FromHtml("#AAAA69"); : ColorTranslator.FromHtml("#AAAA69");
text = platform.ToString(); text = platform.ToString();
size = TextRenderer.MeasureText(graphics, text, font); size = TextRenderer.MeasureText(graphics, text, font);
bounds = new Rectangle(bounds.X + bounds.Width, bounds.Y, size.Width, bounds.Height); bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width };
selectionBounds selectionBounds
= new Rectangle(selectionBounds.Location, selectionBounds.Size + new Size(bounds.Size.Width, 0)); = new Rectangle(selectionBounds.Location, selectionBounds.Size + bounds.Size with { Height = 0 });
graphics.FillRectangle(brush, bounds); graphics.FillRectangle(brush, bounds);
point = new Point(bounds.Location.X - 1, bounds.Location.Y + 1); point = new Point(bounds.Location.X - 1, bounds.Location.Y + 1);
TextRenderer.DrawText(graphics, text, font, point, color, TextFormatFlags.Default); TextRenderer.DrawText(graphics, text, font, point, color, TextFormatFlags.Default);
@ -103,7 +103,7 @@ internal class CustomTreeView : TreeView
text = platformId; text = platformId;
size = TextRenderer.MeasureText(graphics, text, font); size = TextRenderer.MeasureText(graphics, text, font);
int left = -4; int left = -4;
bounds = new Rectangle(bounds.X + bounds.Width + left, bounds.Y, size.Width, bounds.Height); bounds = bounds with { X = bounds.X + bounds.Width + left, Width = size.Width };
selectionBounds = new Rectangle(selectionBounds.Location, selectionBounds = new Rectangle(selectionBounds.Location,
selectionBounds.Size + new Size(bounds.Size.Width + left, 0)); selectionBounds.Size + new Size(bounds.Size.Width + left, 0));
graphics.FillRectangle(brush, bounds); graphics.FillRectangle(brush, bounds);
@ -120,7 +120,7 @@ internal class CustomTreeView : TreeView
if (bounds == node.Bounds) if (bounds == node.Bounds)
{ {
size = new Size(4, 0); size = new Size(4, 0);
bounds = new Rectangle(bounds.X + bounds.Width, bounds.Y, size.Width, bounds.Height); bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width };
graphics.FillRectangle(brush, bounds); graphics.FillRectangle(brush, bounds);
} }
CheckBoxState checkBoxState = selection.Koaloader CheckBoxState checkBoxState = selection.Koaloader
@ -129,9 +129,9 @@ internal class CustomTreeView : TreeView
? CheckBoxState.UncheckedPressed ? CheckBoxState.UncheckedPressed
: CheckBoxState.UncheckedDisabled; : CheckBoxState.UncheckedDisabled;
size = CheckBoxRenderer.GetGlyphSize(graphics, checkBoxState); size = CheckBoxRenderer.GetGlyphSize(graphics, checkBoxState);
bounds = new Rectangle(bounds.X + bounds.Width, bounds.Y, size.Width, bounds.Height); bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width };
selectionBounds = new Rectangle(selectionBounds.Location, selectionBounds = new Rectangle(selectionBounds.Location,
selectionBounds.Size + new Size(bounds.Size.Width, 0)); selectionBounds.Size + bounds.Size with { Height = 0 });
Rectangle checkBoxBounds = bounds; Rectangle checkBoxBounds = bounds;
graphics.FillRectangle(backBrush, bounds); graphics.FillRectangle(backBrush, bounds);
point = new Point(bounds.Left, bounds.Top + bounds.Height / 2 - size.Height / 2 - 1); point = new Point(bounds.Left, bounds.Top + bounds.Height / 2 - size.Height / 2 - 1);
@ -139,11 +139,11 @@ internal class CustomTreeView : TreeView
text = koaloaderToggleString; text = koaloaderToggleString;
size = TextRenderer.MeasureText(graphics, text, font); size = TextRenderer.MeasureText(graphics, text, font);
int left = 1; int left = 1;
bounds = new Rectangle(bounds.X + bounds.Width, bounds.Y, size.Width + left, bounds.Height); bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width + left };
selectionBounds = new Rectangle(selectionBounds.Location, selectionBounds = new Rectangle(selectionBounds.Location,
selectionBounds.Size + new Size(bounds.Size.Width, 0)); selectionBounds.Size + bounds.Size with { Height = 0 });
checkBoxBounds = new Rectangle(checkBoxBounds.Location, checkBoxBounds = new Rectangle(checkBoxBounds.Location,
checkBoxBounds.Size + new Size(bounds.Size.Width, 0)); checkBoxBounds.Size + bounds.Size with { Height = 0 });
graphics.FillRectangle(backBrush, bounds); graphics.FillRectangle(backBrush, bounds);
point = new Point(bounds.Location.X - 1 + left, bounds.Location.Y + 1); point = new Point(bounds.Location.X - 1 + left, bounds.Location.Y + 1);
TextRenderer.DrawText(graphics, text, font, point, TextRenderer.DrawText(graphics, text, font, point,
@ -164,13 +164,13 @@ internal class CustomTreeView : TreeView
bounds = new Rectangle(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width, bounds = new Rectangle(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width,
bounds.Height - padding); bounds.Height - padding);
selectionBounds = new Rectangle(selectionBounds.Location, selectionBounds = new Rectangle(selectionBounds.Location,
selectionBounds.Size + new Size(bounds.Size.Width, 0)); selectionBounds.Size + bounds.Size with { Height = 0 });
Rectangle comboBoxBounds = bounds; Rectangle comboBoxBounds = bounds;
graphics.FillRectangle(backBrush, bounds); graphics.FillRectangle(backBrush, bounds);
ComboBoxRenderer.DrawTextBox(graphics, bounds, text, comboBoxFont, comboBoxState); ComboBoxRenderer.DrawTextBox(graphics, bounds, text, comboBoxFont, comboBoxState);
size = new Size(14, 0); size = new Size(14, 0);
left = -1; left = -1;
bounds = new Rectangle(bounds.X + bounds.Width + left, bounds.Y, size.Width, bounds.Height); bounds = bounds with { X = bounds.X + bounds.Width + left, Width = size.Width };
selectionBounds = new Rectangle(selectionBounds.Location, selectionBounds = new Rectangle(selectionBounds.Location,
selectionBounds.Size + new Size(bounds.Size.Width + left, 0)); selectionBounds.Size + new Size(bounds.Size.Width + left, 0));
comboBoxBounds = new Rectangle(comboBoxBounds.Location, comboBoxBounds = new Rectangle(comboBoxBounds.Location,

View file

@ -58,8 +58,10 @@ internal partial class MainForm : CustomForm
updateButton.Click -= OnUpdateCancel; updateButton.Click -= OnUpdateCancel;
progressLabel.Text = "Checking for updates . . ."; progressLabel.Text = "Checking for updates . . .";
changelogTreeView.Visible = false; changelogTreeView.Visible = false;
changelogTreeView.Location = new Point(progressLabel.Location.X, changelogTreeView.Location = progressLabel.Location with
progressLabel.Location.Y + progressLabel.Size.Height + 13); {
Y = progressLabel.Location.Y + progressLabel.Size.Height + 13
};
Refresh(); Refresh();
#if DEBUG #if DEBUG
DebugForm.Current.Attach(this); DebugForm.Current.Attach(this);
@ -187,7 +189,7 @@ internal partial class MainForm : CustomForm
updateButton.Click -= OnUpdate; updateButton.Click -= OnUpdate;
updateButton.Click += OnUpdateCancel; updateButton.Click += OnUpdateCancel;
changelogTreeView.Location changelogTreeView.Location
= new Point(progressBar.Location.X, progressBar.Location.Y + progressBar.Size.Height + 6); = progressBar.Location with { Y = progressBar.Location.Y + progressBar.Size.Height + 6 };
Refresh(); Refresh();
Progress<double> progress = new(); Progress<double> progress = new();
progress.ProgressChanged += delegate(object sender, double _progress) progress.ProgressChanged += delegate(object sender, double _progress)

View file

@ -690,11 +690,14 @@ internal partial class SelectForm : CustomForm
progressLabelDLCs.Text = ""; progressLabelDLCs.Text = "";
progressLabelDLCs.Visible = true; progressLabelDLCs.Visible = true;
progressBar.Visible = true; progressBar.Visible = true;
programsGroupBox.Size = new Size(programsGroupBox.Size.Width, programsGroupBox.Size.Height - 3 programsGroupBox.Size = programsGroupBox.Size with
- progressLabel.Size.Height {
- progressLabelGames.Size.Height Height = programsGroupBox.Size.Height - 3
- progressLabelDLCs.Size.Height - progressLabel.Size.Height
- progressBar.Size.Height); - progressLabelGames.Size.Height
- progressLabelDLCs.Size.Height
- progressBar.Size.Height
};
} }
private void HideProgressBar() private void HideProgressBar()
@ -704,11 +707,14 @@ internal partial class SelectForm : CustomForm
progressLabelGames.Visible = false; progressLabelGames.Visible = false;
progressLabelDLCs.Visible = false; progressLabelDLCs.Visible = false;
progressBar.Visible = false; progressBar.Visible = false;
programsGroupBox.Size = new Size(programsGroupBox.Size.Width, programsGroupBox.Size.Height + 3 programsGroupBox.Size = programsGroupBox.Size with
+ progressLabel.Size.Height {
+ progressLabelGames.Size.Height Height = programsGroupBox.Size.Height + 3
+ progressLabelDLCs.Size.Height + progressLabel.Size.Height
+ progressBar.Size.Height); + progressLabelGames.Size.Height
+ progressLabelDLCs.Size.Height
+ progressBar.Size.Height
};
} }
internal void OnNodeRightClick(TreeNode node, Point location) => Invoke(() => internal void OnNodeRightClick(TreeNode node, Point location) => Invoke(() =>