diff --git a/LinearAppLauncher.csproj b/LinearAppLauncher.csproj index ffaedc6..0c8e3c8 100644 --- a/LinearAppLauncher.csproj +++ b/LinearAppLauncher.csproj @@ -60,6 +60,12 @@ Form + + UserControl + + + HeadingPanel.cs + MainForm.cs @@ -73,6 +79,9 @@ Resources.resx True + + HeadingPanel.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -86,5 +95,6 @@ + \ No newline at end of file diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index d1479fc..ebf74c2 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -28,25 +28,22 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.button1 = new System.Windows.Forms.Button(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.panel1 = new System.Windows.Forms.Panel(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.label1 = new System.Windows.Forms.Label(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.panel2 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); this.panel5 = new System.Windows.Forms.Panel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.headingPanel1 = new AppLauncher.Windows.Forms.HeadingPanel(); this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // button1 // - this.button1.Location = new System.Drawing.Point(344, 65); + this.button1.Location = new System.Drawing.Point(12, 171); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(120, 40); this.button1.TabIndex = 0; @@ -64,37 +61,12 @@ // panel1 // this.panel1.BackColor = System.Drawing.Color.LightGray; - this.panel1.Location = new System.Drawing.Point(721, 43); + this.panel1.Location = new System.Drawing.Point(157, 130); this.panel1.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(70, 70); this.panel1.TabIndex = 3; // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.Transparent; - this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage"))); - this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Margin = new System.Windows.Forms.Padding(0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(40, 40); - this.pictureBox1.TabIndex = 4; - this.pictureBox1.TabStop = false; - // - // label1 - // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234))))); - this.label1.Location = new System.Drawing.Point(53, 0); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(747, 40); - this.label1.TabIndex = 5; - this.label1.Text = "Launcher"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // flowLayoutPanel1 // this.flowLayoutPanel1.Controls.Add(this.panel2); @@ -156,6 +128,16 @@ this.tableLayoutPanel1.Size = new System.Drawing.Size(209, 247); this.tableLayoutPanel1.TabIndex = 7; // + // headingPanel1 + // + this.headingPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.headingPanel1.Location = new System.Drawing.Point(0, 0); + this.headingPanel1.MinimumSize = new System.Drawing.Size(40, 40); + this.headingPanel1.Name = "headingPanel1"; + this.headingPanel1.Size = new System.Drawing.Size(800, 40); + this.headingPanel1.TabIndex = 8; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -163,16 +145,14 @@ this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(83)))), ((int)(((byte)(93))))); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.ClientSize = new System.Drawing.Size(800, 440); + this.Controls.Add(this.headingPanel1); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.flowLayoutPanel1); - this.Controls.Add(this.label1); - this.Controls.Add(this.pictureBox1); this.Controls.Add(this.panel1); this.Controls.Add(this.richTextBox1); this.Controls.Add(this.button1); this.Name = "MainForm"; this.Text = "Form1"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.flowLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); @@ -183,14 +163,13 @@ private System.Windows.Forms.Button button1; private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Panel panel4; private System.Windows.Forms.Panel panel5; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private Windows.Forms.HeadingPanel headingPanel1; } } diff --git a/MainForm.cs b/MainForm.cs index f2e5dbb..294476c 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -20,9 +20,6 @@ namespace AppLauncher { InitializeComponent(); - pictureBox1.MouseDown += windowMoveControl_MouseDown; - pictureBox1.MouseUp += windowMoveControl_MouseUp; - pictureBox1.MouseMove += windowMoveControl_MouseMove; } diff --git a/MainForm.resx b/MainForm.resx index 04cf4c4..1af7de1 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -117,13 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAS - cwAAEnMBjCK5BwAAAHNJREFUSEvtlLENgDAMBL3/WtkmS4ARzhcmsXQFBSgnfZO/F0pB7D/03pvnKNJC - Ra6YSI+EilyxLJzcEVeQEXEFGRFXkBFxBRkRV4yiSqjIFX747n/wfa5rpWvm7Kdif+Bm2ZERccUoqoSK - XOGH+6mYYHYCNMlBzlYWbSwAAAAASUVORK5CYII= - - \ No newline at end of file diff --git a/Windows/Forms/AForm.cs b/Windows/Forms/AForm.cs index 40e0b82..428f7e1 100644 --- a/Windows/Forms/AForm.cs +++ b/Windows/Forms/AForm.cs @@ -12,8 +12,8 @@ namespace AppLauncher.Windows.Forms { public class AForm : Form { - private bool windowDragging = false; - private Point windowOffset = new Point(); + //private bool windowDragging = false; + //private Point windowOffset = new Point(); public AForm() : base() { @@ -72,34 +72,34 @@ namespace AppLauncher.Windows.Forms // g.DrawImage(this.BackgroundImage, Point.Empty); //} - protected void windowMoveControl_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } + //protected void windowMoveControl_MouseDown(object sender, MouseEventArgs e) + //{ + // if (e.Button != MouseButtons.Left) + // { + // return; + // } - windowDragging = true; - windowOffset = e.Location; - } + // windowDragging = true; + // windowOffset = e.Location; + //} - protected void windowMoveControl_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - } + //protected void windowMoveControl_MouseUp(object sender, MouseEventArgs e) + //{ + // windowDragging = false; + //} - protected void windowMoveControl_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - Point pos = this.PointToScreen(e.Location); + //protected void windowMoveControl_MouseMove(object sender, MouseEventArgs e) + //{ + // if (windowDragging) + // { + // 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); + // 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.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y); - } - } + // this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, y); + // } + //} } } diff --git a/Windows/Forms/HeadingPanel.Designer.cs b/Windows/Forms/HeadingPanel.Designer.cs new file mode 100644 index 0000000..bd97db2 --- /dev/null +++ b/Windows/Forms/HeadingPanel.Designer.cs @@ -0,0 +1,88 @@ +namespace AppLauncher.Windows.Forms +{ + partial class HeadingPanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HeadingPanel)); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label1 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // pictureBox1 + // + this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.pictureBox1.BackColor = System.Drawing.Color.Transparent; + this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage"))); + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.ErrorImage = null; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(0, 0); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(0); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(40, 40); + this.pictureBox1.TabIndex = 5; + this.pictureBox1.TabStop = false; + // + // label1 + // + this.label1.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.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234))))); + this.label1.Location = new System.Drawing.Point(50, 0); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(647, 40); + this.label1.TabIndex = 6; + this.label1.Text = "Launcher"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // HeadingPanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Controls.Add(this.pictureBox1); + this.MinimumSize = new System.Drawing.Size(40, 40); + this.Name = "HeadingPanel"; + this.Size = new System.Drawing.Size(697, 40); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label1; + } +} diff --git a/Windows/Forms/HeadingPanel.cs b/Windows/Forms/HeadingPanel.cs new file mode 100644 index 0000000..174b687 --- /dev/null +++ b/Windows/Forms/HeadingPanel.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AppLauncher.Windows.Forms +{ + public partial class HeadingPanel : UserControl + { + private bool windowDragging = false; + private Point windowOffset = new Point(); + + public HeadingPanel() + { + InitializeComponent(); + } + + protected override void OnParentBindingContextChanged(EventArgs e) + { + base.OnParentBindingContextChanged(e); + + if (this.Parent != null) + { + if (this.Parent.GetType() == typeof(MainForm)) + { + pictureBox1.MouseDown += parentForm_MouseDown; + pictureBox1.MouseUp += parentForm_MouseUp; + pictureBox1.MouseMove += parentForm_MouseMove; + } + } + } + + protected void parentForm_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + } + + protected void parentForm_MouseUp(object sender, MouseEventArgs e) + { + windowDragging = false; + } + + protected void parentForm_MouseMove(object sender, MouseEventArgs e) + { + if (windowDragging) + { + 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); + } + } + + } +} diff --git a/Windows/Forms/HeadingPanel.resx b/Windows/Forms/HeadingPanel.resx new file mode 100644 index 0000000..04cf4c4 --- /dev/null +++ b/Windows/Forms/HeadingPanel.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAS + cwAAEnMBjCK5BwAAAHNJREFUSEvtlLENgDAMBL3/WtkmS4ARzhcmsXQFBSgnfZO/F0pB7D/03pvnKNJC + Ra6YSI+EilyxLJzcEVeQEXEFGRFXkBFxBRkRV4yiSqjIFX747n/wfa5rpWvm7Kdif+Bm2ZERccUoqoSK + XOGH+6mYYHYCNMlBzlYWbSwAAAAASUVORK5CYII= + + + \ No newline at end of file