WIP: tiles and tiles container
This commit is contained in:
parent
c426c207e9
commit
0f916de22c
@ -74,6 +74,9 @@
|
|||||||
<Compile Include="Windows\Forms\HeadingPanel.Designer.cs">
|
<Compile Include="Windows\Forms\HeadingPanel.Designer.cs">
|
||||||
<DependentUpon>HeadingPanel.cs</DependentUpon>
|
<DependentUpon>HeadingPanel.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\Forms\TilePanelContainer.cs">
|
||||||
|
<SubType>UserControl</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\Forms\TilePanel.cs">
|
<Compile Include="Windows\Forms\TilePanel.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
99
MainForm.Designer.cs
generated
99
MainForm.Designer.cs
generated
@ -30,10 +30,6 @@
|
|||||||
{
|
{
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
|
||||||
this.panel2 = new System.Windows.Forms.Panel();
|
|
||||||
this.panel3 = new System.Windows.Forms.Panel();
|
|
||||||
this.panel5 = new System.Windows.Forms.Panel();
|
|
||||||
this.titlePanel1 = new AppLauncher.Windows.Forms.TitlePanel();
|
this.titlePanel1 = new AppLauncher.Windows.Forms.TitlePanel();
|
||||||
this.headingPanel1 = new AppLauncher.Windows.Forms.HeadingPanel();
|
this.headingPanel1 = new AppLauncher.Windows.Forms.HeadingPanel();
|
||||||
this.panel6 = new System.Windows.Forms.Panel();
|
this.panel6 = new System.Windows.Forms.Panel();
|
||||||
@ -47,13 +43,11 @@
|
|||||||
this.panel14 = new System.Windows.Forms.Panel();
|
this.panel14 = new System.Windows.Forms.Panel();
|
||||||
this.panel15 = new System.Windows.Forms.Panel();
|
this.panel15 = new System.Windows.Forms.Panel();
|
||||||
this.button2 = new System.Windows.Forms.Button();
|
this.button2 = new System.Windows.Forms.Button();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.tilePanel2 = new AppLauncher.Windows.Forms.TilePanel();
|
this.tilePanel2 = new AppLauncher.Windows.Forms.TilePanel();
|
||||||
this.tilePanel1 = new AppLauncher.Windows.Forms.TilePanel();
|
this.tilePanel1 = new AppLauncher.Windows.Forms.TilePanel();
|
||||||
this.panel16 = new System.Windows.Forms.Panel();
|
|
||||||
this.panel4 = new System.Windows.Forms.Panel();
|
this.panel4 = new System.Windows.Forms.Panel();
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
this.flowLayoutPanel1.SuspendLayout();
|
this.tilePanelContainer1 = new AppLauncher.Windows.Forms.TilePanelContainer();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
@ -74,44 +68,6 @@
|
|||||||
this.richTextBox1.TabIndex = 2;
|
this.richTextBox1.TabIndex = 2;
|
||||||
this.richTextBox1.Text = "";
|
this.richTextBox1.Text = "";
|
||||||
//
|
//
|
||||||
// flowLayoutPanel1
|
|
||||||
//
|
|
||||||
this.flowLayoutPanel1.Controls.Add(this.panel2);
|
|
||||||
this.flowLayoutPanel1.Controls.Add(this.panel3);
|
|
||||||
this.flowLayoutPanel1.Controls.Add(this.panel5);
|
|
||||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
|
||||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(557, 130);
|
|
||||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
|
||||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(231, 204);
|
|
||||||
this.flowLayoutPanel1.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// panel2
|
|
||||||
//
|
|
||||||
this.panel2.BackColor = System.Drawing.Color.LightGray;
|
|
||||||
this.panel2.Location = new System.Drawing.Point(3, 3);
|
|
||||||
this.panel2.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
|
|
||||||
this.panel2.Name = "panel2";
|
|
||||||
this.panel2.Size = new System.Drawing.Size(70, 70);
|
|
||||||
this.panel2.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// panel3
|
|
||||||
//
|
|
||||||
this.panel3.BackColor = System.Drawing.Color.LightGray;
|
|
||||||
this.panel3.Location = new System.Drawing.Point(3, 76);
|
|
||||||
this.panel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
|
|
||||||
this.panel3.Name = "panel3";
|
|
||||||
this.panel3.Size = new System.Drawing.Size(70, 70);
|
|
||||||
this.panel3.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// panel5
|
|
||||||
//
|
|
||||||
this.panel5.BackColor = System.Drawing.Color.LightGray;
|
|
||||||
this.panel5.Location = new System.Drawing.Point(76, 3);
|
|
||||||
this.panel5.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
|
|
||||||
this.panel5.Name = "panel5";
|
|
||||||
this.panel5.Size = new System.Drawing.Size(70, 70);
|
|
||||||
this.panel5.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// titlePanel1
|
// titlePanel1
|
||||||
//
|
//
|
||||||
this.titlePanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.titlePanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
@ -245,18 +201,6 @@
|
|||||||
this.button2.UseVisualStyleBackColor = true;
|
this.button2.UseVisualStyleBackColor = true;
|
||||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||||
//
|
//
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoEllipsis = true;
|
|
||||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234)))));
|
|
||||||
this.label1.Location = new System.Drawing.Point(362, 190);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(73, 13);
|
|
||||||
this.label1.TabIndex = 23;
|
|
||||||
this.label1.Text = "OpenOffice OpenOffice";
|
|
||||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// tilePanel2
|
// tilePanel2
|
||||||
//
|
//
|
||||||
this.tilePanel2.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
this.tilePanel2.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||||
@ -269,6 +213,10 @@
|
|||||||
this.tilePanel2.MaximumSize = new System.Drawing.Size(70, 70);
|
this.tilePanel2.MaximumSize = new System.Drawing.Size(70, 70);
|
||||||
this.tilePanel2.MinimumSize = new System.Drawing.Size(70, 70);
|
this.tilePanel2.MinimumSize = new System.Drawing.Size(70, 70);
|
||||||
this.tilePanel2.Name = "tilePanel2";
|
this.tilePanel2.Name = "tilePanel2";
|
||||||
|
this.tilePanel2.ProcessArgument = null;
|
||||||
|
this.tilePanel2.ProcessFilename = null;
|
||||||
|
this.tilePanel2.ProcessWindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
||||||
|
this.tilePanel2.ProcessWorkingDirectory = null;
|
||||||
this.tilePanel2.Size = new System.Drawing.Size(70, 70);
|
this.tilePanel2.Size = new System.Drawing.Size(70, 70);
|
||||||
this.tilePanel2.TabIndex = 25;
|
this.tilePanel2.TabIndex = 25;
|
||||||
this.tilePanel2.TitleText = "Accessories";
|
this.tilePanel2.TitleText = "Accessories";
|
||||||
@ -285,21 +233,14 @@
|
|||||||
this.tilePanel1.MaximumSize = new System.Drawing.Size(70, 70);
|
this.tilePanel1.MaximumSize = new System.Drawing.Size(70, 70);
|
||||||
this.tilePanel1.MinimumSize = new System.Drawing.Size(70, 70);
|
this.tilePanel1.MinimumSize = new System.Drawing.Size(70, 70);
|
||||||
this.tilePanel1.Name = "tilePanel1";
|
this.tilePanel1.Name = "tilePanel1";
|
||||||
|
this.tilePanel1.ProcessArgument = null;
|
||||||
|
this.tilePanel1.ProcessFilename = null;
|
||||||
|
this.tilePanel1.ProcessWindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
||||||
|
this.tilePanel1.ProcessWorkingDirectory = null;
|
||||||
this.tilePanel1.Size = new System.Drawing.Size(70, 70);
|
this.tilePanel1.Size = new System.Drawing.Size(70, 70);
|
||||||
this.tilePanel1.TabIndex = 24;
|
this.tilePanel1.TabIndex = 24;
|
||||||
this.tilePanel1.TitleText = "Mail";
|
this.tilePanel1.TitleText = "Mail";
|
||||||
//
|
//
|
||||||
// panel16
|
|
||||||
//
|
|
||||||
this.panel16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
|
|
||||||
this.panel16.BackgroundImage = global::AppLauncher.Properties.Resources.mail_ea_32;
|
|
||||||
this.panel16.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
|
||||||
this.panel16.Location = new System.Drawing.Point(365, 120);
|
|
||||||
this.panel16.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
|
|
||||||
this.panel16.Name = "panel16";
|
|
||||||
this.panel16.Size = new System.Drawing.Size(70, 70);
|
|
||||||
this.panel16.TabIndex = 22;
|
|
||||||
//
|
|
||||||
// panel4
|
// panel4
|
||||||
//
|
//
|
||||||
this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
|
this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
|
||||||
@ -322,6 +263,16 @@
|
|||||||
this.panel1.Size = new System.Drawing.Size(70, 70);
|
this.panel1.Size = new System.Drawing.Size(70, 70);
|
||||||
this.panel1.TabIndex = 3;
|
this.panel1.TabIndex = 3;
|
||||||
//
|
//
|
||||||
|
// tilePanelContainer1
|
||||||
|
//
|
||||||
|
this.tilePanelContainer1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||||
|
this.tilePanelContainer1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||||
|
this.tilePanelContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
||||||
|
this.tilePanelContainer1.Location = new System.Drawing.Point(509, 109);
|
||||||
|
this.tilePanelContainer1.Name = "tilePanelContainer1";
|
||||||
|
this.tilePanelContainer1.Size = new System.Drawing.Size(278, 220);
|
||||||
|
this.tilePanelContainer1.TabIndex = 26;
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -329,10 +280,9 @@
|
|||||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(83)))), ((int)(((byte)(93)))));
|
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(83)))), ((int)(((byte)(93)))));
|
||||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 440);
|
this.ClientSize = new System.Drawing.Size(800, 440);
|
||||||
|
this.Controls.Add(this.tilePanelContainer1);
|
||||||
this.Controls.Add(this.tilePanel2);
|
this.Controls.Add(this.tilePanel2);
|
||||||
this.Controls.Add(this.tilePanel1);
|
this.Controls.Add(this.tilePanel1);
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.panel16);
|
|
||||||
this.Controls.Add(this.button2);
|
this.Controls.Add(this.button2);
|
||||||
this.Controls.Add(this.panel12);
|
this.Controls.Add(this.panel12);
|
||||||
this.Controls.Add(this.panel13);
|
this.Controls.Add(this.panel13);
|
||||||
@ -347,13 +297,11 @@
|
|||||||
this.Controls.Add(this.panel4);
|
this.Controls.Add(this.panel4);
|
||||||
this.Controls.Add(this.headingPanel1);
|
this.Controls.Add(this.headingPanel1);
|
||||||
this.Controls.Add(this.titlePanel1);
|
this.Controls.Add(this.titlePanel1);
|
||||||
this.Controls.Add(this.flowLayoutPanel1);
|
|
||||||
this.Controls.Add(this.panel1);
|
this.Controls.Add(this.panel1);
|
||||||
this.Controls.Add(this.richTextBox1);
|
this.Controls.Add(this.richTextBox1);
|
||||||
this.Controls.Add(this.button1);
|
this.Controls.Add(this.button1);
|
||||||
this.Name = "MainForm";
|
this.Name = "MainForm";
|
||||||
this.Text = "Form1";
|
this.Text = "Form1";
|
||||||
this.flowLayoutPanel1.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -363,10 +311,6 @@
|
|||||||
private System.Windows.Forms.Button button1;
|
private System.Windows.Forms.Button button1;
|
||||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||||
private System.Windows.Forms.Panel panel1;
|
private System.Windows.Forms.Panel panel1;
|
||||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
|
||||||
private System.Windows.Forms.Panel panel2;
|
|
||||||
private System.Windows.Forms.Panel panel3;
|
|
||||||
private System.Windows.Forms.Panel panel5;
|
|
||||||
private Windows.Forms.TitlePanel titlePanel1;
|
private Windows.Forms.TitlePanel titlePanel1;
|
||||||
private Windows.Forms.HeadingPanel headingPanel1;
|
private Windows.Forms.HeadingPanel headingPanel1;
|
||||||
private System.Windows.Forms.Panel panel4;
|
private System.Windows.Forms.Panel panel4;
|
||||||
@ -381,10 +325,9 @@
|
|||||||
private System.Windows.Forms.Panel panel14;
|
private System.Windows.Forms.Panel panel14;
|
||||||
private System.Windows.Forms.Panel panel15;
|
private System.Windows.Forms.Panel panel15;
|
||||||
private System.Windows.Forms.Button button2;
|
private System.Windows.Forms.Button button2;
|
||||||
private System.Windows.Forms.Panel panel16;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
private Windows.Forms.TilePanel tilePanel1;
|
private Windows.Forms.TilePanel tilePanel1;
|
||||||
private Windows.Forms.TilePanel tilePanel2;
|
private Windows.Forms.TilePanel tilePanel2;
|
||||||
|
private Windows.Forms.TilePanelContainer tilePanelContainer1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
81
MainForm.cs
81
MainForm.cs
@ -24,40 +24,87 @@ namespace AppLauncher
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
private async void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (this.Width > 40)
|
if (this.Width > 40)
|
||||||
{
|
{
|
||||||
while (this.Width > 40)
|
await collapseWindow(40, 6);
|
||||||
{
|
|
||||||
this.Width -= 6;
|
|
||||||
|
|
||||||
Application.DoEvents();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (this.Width < 800)
|
await expandWindow(800, 8);
|
||||||
{
|
|
||||||
this.Width += 8;
|
|
||||||
|
|
||||||
Application.DoEvents();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
private void button2_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ProcessStartInfo process = new ProcessStartInfo();
|
//ProcessStartInfo process = new ProcessStartInfo();
|
||||||
process.FileName = @"C:\B\Portable Files (pure)\Build and Deploy Utility\v0.2.0.046 alpha\badutil.exe";
|
//process.FileName = @"C:\B\Portable Files (pure)\Build and Deploy Utility\v0.2.0.046 alpha\badutil.exe";
|
||||||
process.Verb = "runas";
|
//process.Arguments = "";
|
||||||
|
//process.WindowStyle = ProcessWindowStyle.Normal;
|
||||||
|
//process.Verb = "runas";
|
||||||
|
//Process.Start(process);
|
||||||
|
|
||||||
|
//richTextBox1.Text += tilePanelContainer1.GridSize.ToString() + Environment.NewLine;
|
||||||
|
|
||||||
|
tilePanelContainer1.Controls.Add(tilePanel1);
|
||||||
|
tilePanel1.Location = new Point(0, 0);
|
||||||
|
|
||||||
|
tilePanelContainer1.Controls.Add(tilePanel2);
|
||||||
|
tilePanel2.Location = new Point(0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Process.Start(process);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async Task collapseWindow(int width, int increment = 8)
|
||||||
|
{
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
while (this.Width > width)
|
||||||
|
{
|
||||||
|
if (this.InvokeRequired)
|
||||||
|
{
|
||||||
|
this.Invoke(new MethodInvoker(() => {
|
||||||
|
this.Width -= increment;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Width -= increment;
|
||||||
|
}
|
||||||
|
|
||||||
|
Application.DoEvents();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task expandWindow(int width, int increment = 8)
|
||||||
|
{
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
while (this.Width < width)
|
||||||
|
{
|
||||||
|
if (this.InvokeRequired)
|
||||||
|
{
|
||||||
|
this.Invoke(new MethodInvoker(() => {
|
||||||
|
this.Width += increment;
|
||||||
|
this.Invalidate();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Width += increment;
|
||||||
|
this.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
Application.DoEvents();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//private void Form1_MouseDown(object sender, MouseEventArgs e)
|
//private void Form1_MouseDown(object sender, MouseEventArgs e)
|
||||||
//{
|
//{
|
||||||
|
@ -7,14 +7,44 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace AppLauncher.Windows.Forms
|
namespace AppLauncher.Windows.Forms
|
||||||
{
|
{
|
||||||
public partial class TilePanel : AUserControl
|
public partial class TilePanel : AUserControl
|
||||||
{
|
{
|
||||||
|
protected bool isDragging = false;
|
||||||
|
protected Point startPosition = new Point();
|
||||||
|
|
||||||
public TilePanel() : base()
|
public TilePanel() : base()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.MouseDown += panel_MouseDown;
|
||||||
|
this.MouseUp += panel_MouseUp;
|
||||||
|
this.MouseMove += panel_MouseMove;
|
||||||
|
pictureBox1.MouseDown += panel_MouseDown;
|
||||||
|
pictureBox1.MouseUp += panel_MouseUp;
|
||||||
|
pictureBox1.MouseMove += panel_MouseMove;
|
||||||
|
label1.MouseDown += panel_MouseDown;
|
||||||
|
label1.MouseUp += panel_MouseUp;
|
||||||
|
label1.MouseMove += panel_MouseMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocationChanged(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLocationChanged(e);
|
||||||
|
|
||||||
|
if (this.Parent != null)
|
||||||
|
{
|
||||||
|
if (this.Parent.GetType() == typeof(TilePanelContainer))
|
||||||
|
{
|
||||||
|
TilePanelContainer container = (TilePanelContainer)this.Parent;
|
||||||
|
Point p = container.GetTilePosition(this.Location);
|
||||||
|
|
||||||
|
//label1.Text = p.X.ToString() + ", " + p.Y.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Category("Appearance"), Browsable(true)]
|
[Category("Appearance"), Browsable(true)]
|
||||||
@ -23,5 +53,98 @@ namespace AppLauncher.Windows.Forms
|
|||||||
[Category("Appearance"), Browsable(true)]
|
[Category("Appearance"), Browsable(true)]
|
||||||
public Image IconImage { get => pictureBox1.BackgroundImage; set => pictureBox1.BackgroundImage = value; }
|
public Image IconImage { get => pictureBox1.BackgroundImage; set => pictureBox1.BackgroundImage = value; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
public string ProcessFilename { get; set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
public string ProcessArgument { get; set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
public string ProcessWorkingDirectory { get; set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
public ProcessWindowStyle ProcessWindowStyle { get; set; } = ProcessWindowStyle.Normal;
|
||||||
|
|
||||||
|
public TilePanelContainer PanelContainer
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (this.Parent == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.Parent.GetType() != typeof(TilePanelContainer))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (TilePanelContainer)this.Parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void panel_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
TilePanelContainer container = this.PanelContainer;
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.Button != MouseButtons.Left)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isDragging = true;
|
||||||
|
startPosition = e.Location;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void panel_MouseUp(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
isDragging = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void panel_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (isDragging)
|
||||||
|
{
|
||||||
|
TilePanelContainer container = this.PanelContainer;
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//label1.Text = e.Location.ToString();
|
||||||
|
//this.Location = new Point(e.Location.X - windowOffset.X, e.Location.Y - windowOffset.Y);
|
||||||
|
|
||||||
|
//int x = parentPosition.X + (e.Location.X - positionOffset.X);
|
||||||
|
//int y = parentPosition.Y + (e.Location.Y - positionOffset.Y);
|
||||||
|
//this.Location = new Point(x, y);
|
||||||
|
|
||||||
|
//int x = (tilePosition.X + e.Location.X);
|
||||||
|
//int y = (tilePosition.Y + e.Location.Y);
|
||||||
|
|
||||||
|
int x = (this.Location.X + (e.Location.X - startPosition.X));
|
||||||
|
int y = (this.Location.Y + (e.Location.Y - startPosition.Y));
|
||||||
|
|
||||||
|
this.Location = container.GetTilePosition(x, y);
|
||||||
|
|
||||||
|
|
||||||
|
//label1.Text = x.ToString() + ", " + y.ToString();
|
||||||
|
|
||||||
|
//label1.Text = e.X.ToString() + ", " + e.Y.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
//Point pos = this.PointToScreen(e.Location);
|
||||||
|
|
||||||
|
//int y = Math.Max((pos.Y - windowOffset.Y), Screen.PrimaryScreen.WorkingArea.Y);
|
||||||
|
//y = Math.Min(y, (Screen.PrimaryScreen.WorkingArea.Y + Screen.PrimaryScreen.WorkingArea.Height) - this.Height);
|
||||||
|
|
||||||
|
//this.Parent.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
72
Windows/Forms/TilePanelContainer.cs
Normal file
72
Windows/Forms/TilePanelContainer.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AppLauncher.Windows.Forms
|
||||||
|
{
|
||||||
|
public class TilePanelContainer : AUserControl
|
||||||
|
{
|
||||||
|
protected readonly int tileSize = 70;
|
||||||
|
protected readonly int margin = 3;
|
||||||
|
|
||||||
|
public TilePanelContainer() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLoad(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoad(e);
|
||||||
|
|
||||||
|
OnResize(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnResize(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnResize(e);
|
||||||
|
|
||||||
|
int tileWidth = (tileSize + margin);
|
||||||
|
int w = (int)Math.Floor(decimal.Divide(this.Width, tileWidth));
|
||||||
|
int h = (int)Math.Floor(decimal.Divide(this.Height, tileWidth));
|
||||||
|
|
||||||
|
this.GridSize = new Point(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point GridSize { get; protected set; }
|
||||||
|
|
||||||
|
public Point GetTileCoord(Point location) => this.GetTileCoord(location.X, location.Y);
|
||||||
|
|
||||||
|
public Point GetTileCoord(int posX, int posY)
|
||||||
|
{
|
||||||
|
int w = (tileSize + margin);
|
||||||
|
int x = (int)Math.Round(decimal.Divide(posX, w));
|
||||||
|
int y = (int)Math.Round(decimal.Divide(posY, w));
|
||||||
|
|
||||||
|
if (x < 0) x = 0;
|
||||||
|
if (y < 0) y = 0;
|
||||||
|
|
||||||
|
return new Point(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point GetTilePosition(Point location) => this.GetTilePosition(location.X, location.Y);
|
||||||
|
|
||||||
|
public Point GetTilePosition(int posX, int posY)
|
||||||
|
{
|
||||||
|
int w = (tileSize + margin);
|
||||||
|
int x = (int)Math.Round(decimal.Divide(posX, w));
|
||||||
|
int y = (int)Math.Round(decimal.Divide(posY, w));
|
||||||
|
|
||||||
|
if (x < 0) x = 0;
|
||||||
|
if (y < 0) y = 0;
|
||||||
|
|
||||||
|
return new Point((x * w), (y * w));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
2
Windows/Forms/TitlePanel.Designer.cs
generated
2
Windows/Forms/TitlePanel.Designer.cs
generated
@ -71,7 +71,7 @@
|
|||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.pictureBox1);
|
this.Controls.Add(this.pictureBox1);
|
||||||
this.MinimumSize = new System.Drawing.Size(40, 40);
|
this.MinimumSize = new System.Drawing.Size(100, 40);
|
||||||
this.Name = "TitlePanel";
|
this.Name = "TitlePanel";
|
||||||
this.Size = new System.Drawing.Size(697, 40);
|
this.Size = new System.Drawing.Size(697, 40);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||||
|
@ -12,7 +12,7 @@ namespace AppLauncher.Windows.Forms
|
|||||||
{
|
{
|
||||||
public partial class TitlePanel : UserControl
|
public partial class TitlePanel : UserControl
|
||||||
{
|
{
|
||||||
private bool windowDragging = false;
|
private bool isDragging = false;
|
||||||
private Point windowOffset = new Point();
|
private Point windowOffset = new Point();
|
||||||
|
|
||||||
public TitlePanel()
|
public TitlePanel()
|
||||||
@ -49,18 +49,18 @@ namespace AppLauncher.Windows.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
windowDragging = true;
|
isDragging = true;
|
||||||
windowOffset = e.Location;
|
windowOffset = e.Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void parentForm_MouseUp(object sender, MouseEventArgs e)
|
protected void parentForm_MouseUp(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
windowDragging = false;
|
isDragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void parentForm_MouseMove(object sender, MouseEventArgs e)
|
protected void parentForm_MouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (windowDragging)
|
if (isDragging)
|
||||||
{
|
{
|
||||||
Point pos = this.PointToScreen(e.Location);
|
Point pos = this.PointToScreen(e.Location);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user