Changed: tile list group with coord

This commit is contained in:
Ray 2020-05-17 03:24:46 +01:00
parent d4258b39eb
commit 2e111a3bce
12 changed files with 350 additions and 249 deletions

View File

@ -134,15 +134,15 @@
<Compile Include="RyzStudio\Windows\ThemedForms\TUserControl.designer.cs"> <Compile Include="RyzStudio\Windows\ThemedForms\TUserControl.designer.cs">
<DependentUpon>TUserControl.cs</DependentUpon> <DependentUpon>TUserControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Windows\Forms\Tile\AddListTileForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Forms\Tile\AddTileForm.cs"> <Compile Include="Windows\Forms\Tile\AddTileForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Windows\Forms\Tile\EditGroupForm.cs"> <Compile Include="Windows\Forms\Tile\EditGroupForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Windows\Forms\Tile\AddListTileForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Forms\Tile\EditListTileForm.cs"> <Compile Include="Windows\Forms\Tile\EditListTileForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -196,15 +196,15 @@
<EmbeddedResource Include="RyzStudio\Windows\ThemedForms\TButtonTextBox.resx"> <EmbeddedResource Include="RyzStudio\Windows\ThemedForms\TButtonTextBox.resx">
<DependentUpon>TButtonTextBox.cs</DependentUpon> <DependentUpon>TButtonTextBox.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\AddListTileForm.resx">
<DependentUpon>AddListTileForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\AddTileForm.resx"> <EmbeddedResource Include="Windows\Forms\Tile\AddTileForm.resx">
<DependentUpon>AddTileForm.cs</DependentUpon> <DependentUpon>AddTileForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\EditGroupForm.resx"> <EmbeddedResource Include="Windows\Forms\Tile\EditGroupForm.resx">
<DependentUpon>EditGroupForm.cs</DependentUpon> <DependentUpon>EditGroupForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\AddListTileForm.resx">
<DependentUpon>AddListTileForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\EditListTileForm.resx"> <EmbeddedResource Include="Windows\Forms\Tile\EditListTileForm.resx">
<DependentUpon>EditListTileForm.cs</DependentUpon> <DependentUpon>EditListTileForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -28,31 +28,12 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.lblDescription = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.imgbxClose = new RyzStudio.Windows.Forms.TImageBox(); this.imgbxClose = new RyzStudio.Windows.Forms.TImageBox();
this.area1 = new System.Windows.Forms.Panel(); this.area1 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// lblDescription
//
this.lblDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblDescription.BackColor = System.Drawing.Color.Transparent;
this.lblDescription.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDescription.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241)))));
this.lblDescription.Location = new System.Drawing.Point(1, 1);
this.lblDescription.Name = "lblDescription";
this.lblDescription.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
this.lblDescription.Size = new System.Drawing.Size(301, 30);
this.lblDescription.TabIndex = 148;
this.lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblDescription.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick);
this.lblDescription.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown);
this.lblDescription.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label1_MouseMove);
this.lblDescription.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label1_MouseUp);
//
// panel1 // panel1
// //
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -62,9 +43,6 @@
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(5, 5); this.panel1.Size = new System.Drawing.Size(5, 5);
this.panel1.TabIndex = 150; this.panel1.TabIndex = 150;
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);
// //
// imgbxClose // imgbxClose
// //
@ -93,22 +71,18 @@
this.area1.Name = "area1"; this.area1.Name = "area1";
this.area1.Size = new System.Drawing.Size(334, 5); this.area1.Size = new System.Drawing.Size(334, 5);
this.area1.TabIndex = 151; this.area1.TabIndex = 151;
this.area1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown);
this.area1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove);
this.area1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseUp);
// //
// DialogForm // TDialogForm
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(249)))), ((int)(((byte)(250))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(249)))), ((int)(((byte)(250)))));
this.ClientSize = new System.Drawing.Size(340, 600); this.ClientSize = new System.Drawing.Size(340, 600);
this.Controls.Add(this.area1); this.Controls.Add(this.area1);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.lblDescription);
this.Controls.Add(this.imgbxClose); this.Controls.Add(this.imgbxClose);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MinimumSize = new System.Drawing.Size(40, 0); this.MinimumSize = new System.Drawing.Size(40, 0);
this.Name = "DialogForm"; this.Name = "TDialogForm";
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -116,7 +90,6 @@
#endregion #endregion
protected internal Forms.TImageBox imgbxClose; protected internal Forms.TImageBox imgbxClose;
protected internal System.Windows.Forms.Label lblDescription;
protected internal System.Windows.Forms.Panel panel1; protected internal System.Windows.Forms.Panel panel1;
protected internal System.Windows.Forms.Panel area1; protected internal System.Windows.Forms.Panel area1;
} }

View File

@ -9,28 +9,24 @@
public partial class TDialogForm : System.Windows.Forms.Form public partial class TDialogForm : System.Windows.Forms.Form
{ {
protected readonly Color borderColour = Color.FromArgb(232, 231, 236);
protected readonly int borderWidth = 1;
protected readonly Color titleBarColour = Color.FromArgb(152, 175, 206);
protected readonly Color titleBarForeColour = Color.White;
protected readonly Font titleBarFont = new Font("Segoe UI", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
protected readonly int titleBarHeight = 32;
private bool isDragging = false;
private Point startPosition = new Point();
protected bool isBusy = false; protected bool isBusy = false;
protected Color topFillColour = Color.FromArgb(15, 15, 15);
protected int topFillHeight = 32;
protected int borderWidth = 1;
private bool windowDragging = false;
private Point windowOffset = new Point();
private Point windowSize = new Point();
public TDialogForm() : base() public TDialogForm() : base()
{ {
this.InitializeComponent(); this.InitializeComponent();
this.BackColor = Color.FromArgb(246, 246, 246);
this.Padding = new Padding(1);
this.topFillColour = Color.FromArgb(51, 51, 51);
this.topFillHeight = 32;
this.BackColor = Color.FromArgb(248, 249, 250);
this.FormBorderStyle = FormBorderStyle.None; this.FormBorderStyle = FormBorderStyle.None;
this.ShowInTaskbar = false;
imgbxClose.Click += pictureBox3_Click; imgbxClose.Click += pictureBox3_Click;
} }
@ -45,22 +41,53 @@
} }
} }
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == MouseButtons.Left)
{
isDragging = true;
startPosition = e.Location;
}
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (isDragging)
{
int x = (this.Location.X + (e.Location.X - startPosition.X));
int y = (this.Location.Y + (e.Location.Y - startPosition.Y));
this.Location = new Point(x, y);
}
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
isDragging = false;
}
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)
{ {
base.OnPaint(e); base.OnPaint(e);
Graphics g = e.Graphics; Graphics g = e.Graphics;
Rectangle area = new Rectangle(this.DisplayRectangle.X, this.DisplayRectangle.Y, (this.DisplayRectangle.Width - borderWidth), (this.DisplayRectangle.Height - borderWidth));
Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, this.Padding.Top, this.DisplayRectangle.Width, topFillHeight); // border
Rectangle areaBorder = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width - borderWidth, this.ClientRectangle.Height - borderWidth); g.DrawRectangle(new Pen(borderColour, borderWidth), area);
// draw header area.Inflate((-1 * borderWidth), (-1 * borderWidth));
if (topFillHeight > 0)
{ g.FillRectangle(new SolidBrush(titleBarColour), area.X, area.Y, (area.Width + area.X), titleBarHeight);
g.FillRectangle(new SolidBrush(topFillColour), areaTop);
} TextRenderer.DrawText(g, this.Title, titleBarFont, new Point(12, 11), titleBarForeColour);
g.DrawRectangle(new Pen(Color.Black, borderWidth), areaBorder);
} }
protected override void OnResize(EventArgs e) protected override void OnResize(EventArgs e)
@ -71,7 +98,7 @@
} }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Color BackColor { get => base.BackColor; set => base.BackColor = value; } public override Color BackColor { get => base.BackColor; set => base.BackColor = Color.FromArgb(254, 254, 254); }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; } public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; }
@ -80,17 +107,7 @@
public new Padding Padding { get => base.Padding; set => base.Padding = value; } public new Padding Padding { get => base.Padding; set => base.Padding = value; }
[Category("Appearance"), Browsable(true)] [Category("Appearance"), Browsable(true)]
public string Description public string Title { get; set; }
{
get
{
return lblDescription.Text?.Replace("\n", "\\n");
}
set
{
lblDescription.Text = value?.Replace("\\n", "\n");
}
}
protected virtual bool IsBusy { get => isBusy; set => isBusy = value; } protected virtual bool IsBusy { get => isBusy; set => isBusy = value; }
@ -108,88 +125,6 @@
this.Close(); this.Close();
} }
private void label1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
windowDragging = true;
windowOffset = e.Location;
}
private void label1_MouseUp(object sender, MouseEventArgs e)
{
windowDragging = false;
}
private void label1_MouseMove(object sender, MouseEventArgs e)
{
if (windowDragging)
{
Point currentScreenPos = PointToScreen(e.Location);
Location = new Point(currentScreenPos.X - windowOffset.X, currentScreenPos.Y - windowOffset.Y);
}
}
private void label1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Middle)
{
this.TopMost = !this.TopMost;
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
windowDragging = true;
windowOffset = e.Location;
windowSize = new Point(this.Width, this.Height);
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
windowDragging = false;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (windowDragging)
{
this.Size = new Size(e.X - windowOffset.X + this.Width, e.Y - windowOffset.Y + this.Height);
}
}
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
{
return;
}
windowDragging = true;
windowOffset = e.Location;
windowSize = new Point(this.Width, this.Height);
}
private void panel2_MouseUp(object sender, MouseEventArgs e)
{
windowDragging = false;
}
private void panel2_MouseMove(object sender, MouseEventArgs e)
{
if (windowDragging)
{
this.Size = new Size(windowSize.X, e.Y - windowOffset.Y + this.Height);
}
}
} }
} }

View File

@ -117,9 +117,6 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="lblDescription.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="panel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="panel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

View File

@ -17,12 +17,6 @@
this.Font = new Font(this.Font, FontStyle.Regular); this.Font = new Font(this.Font, FontStyle.Regular);
this.Margin = new Padding(10, 4, 10, 4); this.Margin = new Padding(10, 4, 10, 4);
listBox1.Items.Add("one");
listBox1.Items.Add("two");
listBox1.Items.Add("three");
listBox1.Items.Add("four");
listBox1.Items.Add("five");
listBox1.Font = this.Font; listBox1.Font = this.Font;
listBox1.BorderStyle = BorderStyle.None; listBox1.BorderStyle = BorderStyle.None;
} }

View File

@ -7,10 +7,13 @@ namespace AppLauncher.Windows.Forms
{ {
public class AForm : Form public class AForm : Form
{ {
protected readonly int titleHeight = 56; protected readonly Color borderColour = Color.FromArgb(232, 231, 236);
protected readonly int borderWidth = 1;
protected readonly Color titleBarColour = Color.FromArgb(237, 240, 247);
protected readonly int titleBarHeight = 56;
protected bool isDragging = false; private bool isDragging = false;
protected Point startPosition = new Point(); private Point startPosition = new Point();
public AForm() : base() public AForm() : base()
{ {
@ -21,35 +24,11 @@ namespace AppLauncher.Windows.Forms
} }
} }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
Color borderColour = Color.FromArgb(232, 231, 236);
Color menubarColour = Color.FromArgb(237, 240, 247);
Rectangle area = new Rectangle(this.DisplayRectangle.X, this.DisplayRectangle.Y, (this.DisplayRectangle.Width - 1), (this.DisplayRectangle.Height - 1));
// border
g.DrawRectangle(new Pen(borderColour, 1), area);
area.Inflate(-1, -1);
g.FillRectangle(new SolidBrush(menubarColour), area.X, area.Y, (area.Width + area.X), titleHeight);
g.DrawLine(new Pen(borderColour, 1), area.X, (titleHeight + 1), (area.Width + area.X), (titleHeight + 1));
g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17);
TextRenderer.DrawText(e.Graphics, "Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171));
}
protected override void OnMouseClick(MouseEventArgs e) protected override void OnMouseClick(MouseEventArgs e)
{ {
base.OnMouseClick(e); base.OnMouseClick(e);
bool isLabel = ((e.Location.X >= 0) && (e.Location.X <= this.Width) && (e.Location.Y >= 0) && (e.Location.Y <= titleHeight)); bool isLabel = ((e.Location.X >= 0) && (e.Location.X <= this.Width) && (e.Location.Y >= 0) && (e.Location.Y <= titleBarHeight));
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
@ -112,6 +91,46 @@ namespace AppLauncher.Windows.Forms
isDragging = false; isDragging = false;
} }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
Rectangle area = new Rectangle(this.DisplayRectangle.X, this.DisplayRectangle.Y, (this.DisplayRectangle.Width - borderWidth), (this.DisplayRectangle.Height - borderWidth));
// border
g.DrawRectangle(new Pen(borderColour, borderWidth), area);
area.Inflate((-1 * borderWidth), (-1 * borderWidth));
g.FillRectangle(new SolidBrush(titleBarColour), area.X, area.Y, (area.Width + area.X), titleBarHeight);
g.DrawLine(new Pen(borderColour, 1), area.X, (titleBarHeight + 1), (area.Width + area.X), (titleBarHeight + 1));
g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17);
TextRenderer.DrawText(g, "Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171));
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
this.Invalidate();
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override Color BackColor { get => base.BackColor; set => base.BackColor = Color.FromArgb(254, 254, 254); }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Padding { get => base.Padding; set => base.Padding = new Padding(0); }
[Category("Appearance")]
public ContextMenuStrip TitleContextMenuStrip { get; set; } = null;
protected Point DefaultLocation protected Point DefaultLocation
{ {
get get
@ -127,10 +146,5 @@ namespace AppLauncher.Windows.Forms
} }
} }
public override Color BackColor { get => base.BackColor; set => base.BackColor = Color.FromArgb(254, 254, 254); }
[Category("Appearance")]
public ContextMenuStrip TitleContextMenuStrip { get; set; } = null;
} }
} }

View File

@ -1,24 +1,33 @@
using AppLauncher.Models; using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms;
using System; using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms namespace AppLauncher.Windows.Forms
{ {
public class AddListTileForm : TDialogForm public class AddListTileForm : TDialogForm
{ {
public static void ShowDialog(TTilePanelLayout control) public static void ShowDialog(TTilePanelLayout control, Point coord)
{ {
AddListTileForm form = new AddListTileForm(); AddListTileForm form = new AddListTileForm();
form.TilePanelLayout = control; form.TilePanelLayout = control;
form.AimCoord = coord;
form.ShowDialog(); form.ShowDialog();
} }
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private TButton button1; private TButton button1;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
private TTextBox textBox1; private TTextBox textBox1;
private TListBox listBox1;
private System.Windows.Forms.Label label2;
public TTilePanelLayout TilePanelLayout { get; set; } = null; public TTilePanelLayout TilePanelLayout { get; set; } = null;
public Point AimCoord { get; set; } = new Point(-1, -1);
public AddListTileForm() : base() public AddListTileForm() : base()
{ {
@ -28,13 +37,15 @@ namespace AppLauncher.Windows.Forms
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddListTileForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddListTileForm));
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle style4 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle(); RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle1 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle style5 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle(); RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle2 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle style6 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle(); RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle3 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
this.horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.listBox1 = new RyzStudio.Windows.ThemedForms.TListBox();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -43,11 +54,6 @@ namespace AppLauncher.Windows.Forms
this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image"))); this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image")));
this.imgbxClose.Location = new System.Drawing.Point(367, 5); this.imgbxClose.Location = new System.Drawing.Point(367, 5);
// //
// lblDescription
//
this.lblDescription.Size = new System.Drawing.Size(359, 30);
this.lblDescription.Text = "Add List Tile";
//
// panel1 // panel1
// //
this.panel1.Location = new System.Drawing.Point(394, 474); this.panel1.Location = new System.Drawing.Point(394, 474);
@ -96,48 +102,82 @@ namespace AppLauncher.Windows.Forms
this.button1.OverImage = null; this.button1.OverImage = null;
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(128, 32); this.button1.Size = new System.Drawing.Size(128, 32);
style4.BackColour = System.Drawing.Color.White; buttonStyle1.BackColour = System.Drawing.Color.White;
style4.ForeImage = null; buttonStyle1.ForeImage = null;
style4.PenColour = System.Drawing.Color.Black; buttonStyle1.PenColour = System.Drawing.Color.Black;
this.button1.StyleDefault = style4; this.button1.StyleDefault = buttonStyle1;
style5.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(179)))), ((int)(((byte)(179)))), ((int)(((byte)(179))))); buttonStyle2.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(179)))), ((int)(((byte)(179)))), ((int)(((byte)(179)))));
style5.ForeImage = null; buttonStyle2.ForeImage = null;
style5.PenColour = System.Drawing.Color.Black; buttonStyle2.PenColour = System.Drawing.Color.Black;
this.button1.StyleDown = style5; this.button1.StyleDown = buttonStyle2;
style6.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); buttonStyle3.BackColour = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
style6.ForeImage = null; buttonStyle3.ForeImage = null;
style6.PenColour = System.Drawing.Color.White; buttonStyle3.PenColour = System.Drawing.Color.White;
this.button1.StyleOver = style6; this.button1.StyleOver = buttonStyle3;
this.button1.TabIndex = 173; this.button1.TabIndex = 173;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// horizontalSeparator1 // horizontalSeparator2
// //
this.horizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.horizontalSeparator1.Location = new System.Drawing.Point(10, 92); this.horizontalSeparator2.Location = new System.Drawing.Point(10, 92);
this.horizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2); this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
this.horizontalSeparator1.Name = "horizontalSeparator1"; this.horizontalSeparator2.Name = "horizontalSeparator2";
this.horizontalSeparator1.Size = new System.Drawing.Size(380, 2); this.horizontalSeparator2.Size = new System.Drawing.Size(380, 2);
this.horizontalSeparator1.TabIndex = 176; this.horizontalSeparator2.TabIndex = 177;
// //
// AddListTileForm // listBox1
//
this.listBox1.AllowDrop = true;
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.BackColor = System.Drawing.Color.Transparent;
this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.listBox1.Location = new System.Drawing.Point(159, 101);
this.listBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.listBox1.Name = "listBox1";
this.listBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.listBox1.Size = new System.Drawing.Size(220, 280);
this.listBox1.SubmitButton = null;
this.listBox1.TabIndex = 180;
this.listBox1.OnAdd += new System.EventHandler(this.listBox1_OnAdd);
this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit);
this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop);
this.listBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.listBox1_DragOver);
//
// label2
//
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label2.Location = new System.Drawing.Point(18, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(131, 32);
this.label2.TabIndex = 181;
this.label2.Text = "List";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// EditListTileForm2
// //
this.ClientSize = new System.Drawing.Size(400, 480); this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.horizontalSeparator1); this.Controls.Add(this.label2);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.horizontalSeparator2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Description = "Add List Tile"; this.Name = "EditListTileForm2";
this.Name = "AddListTileForm"; this.Title = "Add List Tile";
this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0); this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.textBox1, 0);
this.Controls.SetChildIndex(this.label1, 0); this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.button1, 0); this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.horizontalSeparator1, 0); this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
this.Controls.SetChildIndex(this.listBox1, 0);
this.Controls.SetChildIndex(this.label2, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -151,10 +191,98 @@ namespace AppLauncher.Windows.Forms
IsGroup = true IsGroup = true
}; };
if (!this.AimCoord.Equals(new Point(-1, -1)))
{
model.Position = this.AimCoord;
}
model.Items = new System.Collections.Generic.List<TileModel>();
foreach (TileModel item in listBox1.ListBox.Items.OfType<TileModel>())
{
if (item.IsGroup)
{
continue;
}
model.Items.Add(item);
}
this.TilePanelLayout.AddTile(model); this.TilePanelLayout.AddTile(model);
this.Close(); this.Close();
} }
private void listBox1_OnAdd(object sender, EventArgs e) => AddTileForm.ShowDialog(listBox1);
private void listBox1_OnEdit(object sender, EventArgs e)
{
if (listBox1.ListBox.Items.Count <= 0)
{
return;
}
EditTileForm.ShowDialog(listBox1);
}
private void listBox1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Link;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
if (fileList == null)
{
return;
}
if (fileList.Length <= 0)
{
return;
}
if (string.IsNullOrWhiteSpace(fileList[0]))
{
return;
}
TileModel model = new TileModel()
{
ProcessFilename = fileList[0],
Title = Path.GetFileName(fileList[0])
};
// exe
if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
{
if (File.Exists(fileList[0]))
{
try
{
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]);
if (fvi != null)
{
model.Title = fvi.ProductName;
}
}
catch
{
// do nothing
}
}
}
listBox1.ListBox.Items.Add(model);
}
} }
} }

View File

@ -84,10 +84,7 @@ namespace AppLauncher.Windows.Forms
this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image"))); this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image")));
this.imgbxClose.Location = new System.Drawing.Point(367, 5); this.imgbxClose.Location = new System.Drawing.Point(367, 5);
// //
// lblDescription this.Text = "Add Tile";
//
this.lblDescription.Size = new System.Drawing.Size(359, 30);
this.lblDescription.Text = "Add Tile";
// //
// panel1 // panel1
// //
@ -324,10 +321,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Description = "Add Tile"; this.Title = "Add Tile";
this.Name = "AddTileForm"; this.Name = "AddTileForm";
this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0); this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.textBox1, 0);

View File

@ -48,8 +48,7 @@ namespace AppLauncher.Windows.Forms
// //
// lblDescription // lblDescription
// //
this.lblDescription.Size = new System.Drawing.Size(359, 30); this.Text = "Edit Group";
this.lblDescription.Text = "Edit Group";
// //
// panel1 // panel1
// //
@ -135,10 +134,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Description = "Edit Group"; this.Title = "Edit Group";
this.Name = "EditGroupForm"; this.Name = "EditGroupForm";
this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0); this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.textBox1, 0);

View File

@ -1,7 +1,10 @@
using AppLauncher.Models; using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms;
using System; using System;
using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms namespace AppLauncher.Windows.Forms
{ {
@ -50,8 +53,7 @@ namespace AppLauncher.Windows.Forms
// //
// lblDescription // lblDescription
// //
this.lblDescription.Size = new System.Drawing.Size(359, 30); this.Title = "Edit List Tile";
this.lblDescription.Text = "Edit List Tile";
// //
// panel1 // panel1
// //
@ -128,6 +130,7 @@ namespace AppLauncher.Windows.Forms
// //
// listBox1 // listBox1
// //
this.listBox1.AllowDrop = true;
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
@ -142,6 +145,8 @@ namespace AppLauncher.Windows.Forms
this.listBox1.TabIndex = 180; this.listBox1.TabIndex = 180;
this.listBox1.OnAdd += new System.EventHandler(this.listBox1_OnAdd); this.listBox1.OnAdd += new System.EventHandler(this.listBox1_OnAdd);
this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit); this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit);
this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop);
this.listBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.listBox1_DragOver);
// //
// label2 // label2
// //
@ -163,10 +168,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Description = "Edit List Tile"; this.Title = "Edit List Tile";
this.Name = "EditListTileForm"; this.Name = "EditListTileForm";
this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0); this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.textBox1, 0);
@ -242,5 +246,64 @@ namespace AppLauncher.Windows.Forms
EditTileForm.ShowDialog(listBox1); EditTileForm.ShowDialog(listBox1);
} }
private void listBox1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Link;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
if (fileList == null)
{
return;
}
if (fileList.Length <= 0)
{
return;
}
if (string.IsNullOrWhiteSpace(fileList[0]))
{
return;
}
TileModel model = new TileModel()
{
ProcessFilename = fileList[0],
Title = Path.GetFileName(fileList[0])
};
// exe
if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
{
if (File.Exists(fileList[0]))
{
try
{
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]);
if (fvi != null)
{
model.Title = fvi.ProductName;
}
}
catch
{
// do nothing
}
}
}
listBox1.ListBox.Items.Add(model);
}
} }
} }

View File

@ -83,8 +83,7 @@ namespace AppLauncher.Windows.Forms
// //
// lblDescription // lblDescription
// //
this.lblDescription.Size = new System.Drawing.Size(359, 30); this.Title = "Edit Tile";
this.lblDescription.Text = "Edit Tile";
// //
// panel1 // panel1
// //
@ -321,10 +320,9 @@ namespace AppLauncher.Windows.Forms
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Description = "Edit Tile"; this.Title = "Edit Tile";
this.Name = "EditTileForm"; this.Name = "EditTileForm";
this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.lblDescription, 0);
this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0); this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.textBox1, 0);

View File

@ -740,7 +740,12 @@ namespace AppLauncher.Windows.Forms
AddTileForm.ShowDialog(this, coord); AddTileForm.ShowDialog(this, coord);
} }
private void addListTileMenuItem_Click(object sender, EventArgs e) => AddListTileForm.ShowDialog(this); private void addListTileMenuItem_Click(object sender, EventArgs e)
{
Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
AddListTileForm.ShowDialog(this, coord);
}
private void addGroupMenuItem_Click(object sender, EventArgs e) => this.AddGroup(); private void addGroupMenuItem_Click(object sender, EventArgs e) => this.AddGroup();