Changed: session settings + layout panel init-size

This commit is contained in:
Ray committed 2020-05-17 19:52:37 +01:00
1 parent 3a2ee532c7
commit c49c9308c0
6 files changed
+93 -46

No files matched your search

+47 -1
View File
@@ -21,6 +21,7 @@ namespace AppLauncher.Windows.Forms
protected internal RyzStudio.Windows.Forms.TImageBox imageBox2;
protected internal RyzStudio.Windows.Forms.TImageBox imageBox1;
private NotifyIcon notifyIcon1;
private Panel panel1;
private IContainer components;
public AForm() : base()
@@ -38,17 +39,25 @@ namespace AppLauncher.Windows.Forms
{
base.OnLoad(e);
this.SuspendLayout();
imageBox3.Left = this.DisplayRectangle.Width - imageBox3.Width - 17;
imageBox3.Top = 18;
imageBox3.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
imageBox2.Left = imageBox3.Left - imageBox2.Width - 8;
imageBox2.Top = 18;
imageBox2.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
imageBox1.Left = imageBox2.Left - imageBox1.Width - 8;
imageBox1.Top = 18;
imageBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
panel1.Left = this.DisplayRectangle.Left;
panel1.Top = this.DisplayRectangle.Height - panel1.Height;
panel1.Width = this.DisplayRectangle.Width;
panel1.Anchor = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom);
this.ResumeLayout();
}
@@ -182,6 +191,7 @@ namespace AppLauncher.Windows.Forms
this.imageBox2 = new RyzStudio.Windows.Forms.TImageBox();
this.imageBox1 = new RyzStudio.Windows.Forms.TImageBox();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.panel1 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.imageBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit();
@@ -249,9 +259,23 @@ namespace AppLauncher.Windows.Forms
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNS;
this.panel1.Location = new System.Drawing.Point(109, 114);
this.panel1.Margin = new System.Windows.Forms.Padding(0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 2);
this.panel1.TabIndex = 149;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp);
//
// AForm
//
this.ClientSize = new System.Drawing.Size(421, 321);
this.Controls.Add(this.panel1);
this.Controls.Add(this.imageBox1);
this.Controls.Add(this.imageBox2);
this.Controls.Add(this.imageBox3);
@@ -302,5 +326,27 @@ namespace AppLauncher.Windows.Forms
notifyIcon1.Visible = !this.Visible;
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isDragging = true;
startPosition = e.Location;
}
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
this.Size = new Size(this.Width, e.Y - startPosition.Y + this.Height);
}
}
}
}
+14 -35
View File
@@ -36,6 +36,7 @@ namespace AppLauncher.Windows.Forms
protected bool isAnimating = false;
protected bool isChecked = true;
protected Point lastMousePosition = new Point();
protected Point gridSize = new Point();
public TTilePanelLayout(TileGroupModel model) : base()
{
@@ -182,10 +183,11 @@ namespace AppLauncher.Windows.Forms
{
get
{
int w = (int)Math.Floor(decimal.Divide(this.Width, this.TileSize));
int h = (int)Math.Floor(decimal.Divide(this.Height - labelHeight, this.TileSize));
//int w = (int)Math.Floor(decimal.Divide(this.Width, this.TileSize));
//int h = (int)Math.Floor(decimal.Divide(this.Height - labelHeight, this.TileSize));
return new Point(w, h);
//return new Point(w, h);
return gridSize;
}
}
@@ -308,20 +310,6 @@ namespace AppLauncher.Windows.Forms
});
}
public async Task CollapseNow()
{
await Task.Run(() =>
{
if (isAnimating) return;
isAnimating = true;
ThreadControl.SetHeight(this, this.CollapseHeight);
isAnimating = false;
});
}
public async Task Expand()
{
await Task.Run(() =>
@@ -355,7 +343,7 @@ namespace AppLauncher.Windows.Forms
return new Point((x * this.TileSize), ((y * this.TileSize) + labelHeight));
}
public async Task InvalidateContainer(bool animate = true)
public async Task InvalidateContainer()
{
if (isAnimating)
{
@@ -368,14 +356,7 @@ namespace AppLauncher.Windows.Forms
}
else
{
if (animate)
{
await this.Collapse();
}
else
{
await this.CollapseNow();
}
await this.Collapse();
}
}
@@ -393,10 +374,7 @@ namespace AppLauncher.Windows.Forms
}));
}
public void AddRow()
{
this.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1));
}
public void AddRow() =>this.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1));
public void EditGroup() => EditGroupForm.ShowDialog(this);
@@ -404,10 +382,9 @@ namespace AppLauncher.Windows.Forms
{
groupInfo = model;
this.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
isChecked = groupInfo.IsExpanded;
this.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
this.LoadTiles(model.Items);
this.Invalidate();
@@ -416,7 +393,7 @@ namespace AppLauncher.Windows.Forms
public void UpdateModel(TileGroupModel model)
{
groupInfo = model;
isChecked = groupInfo.IsExpanded;
//isChecked = groupInfo.IsExpanded;
this.Invalidate();
}
@@ -566,9 +543,12 @@ namespace AppLauncher.Windows.Forms
public void SetGridSize(int width, int height)
{
gridSize = new Point(width, height);
expandedHeight = (this.TileSize * height) + labelHeight;
this.Size = new Size((this.TileSize * width), expandedHeight);
//this.Size = new Size((this.TileSize * width), expandedHeight);
this.Size = new Size((this.TileSize * width), (isChecked ? this.ExpandedHeight : this.CollapseHeight));
}
protected Point convertCoordToLocation(Point position) => new Point((position.X * this.TileSize), ((position.Y * this.TileSize) + labelHeight));
@@ -768,6 +748,5 @@ namespace AppLauncher.Windows.Forms
private void removeGroupMenuItem3_Click(object sender, EventArgs e) => this.Remove();
}
}