diff --git a/LinearAppLauncher.csproj b/LinearAppLauncher.csproj index 6e1ae2f..ffaedc6 100644 --- a/LinearAppLauncher.csproj +++ b/LinearAppLauncher.csproj @@ -57,6 +57,9 @@ + + Form + MainForm.cs @@ -80,5 +83,8 @@ True + + + \ No newline at end of file diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index a41d824..d1479fc 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -28,71 +28,169 @@ /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.button1 = new System.Windows.Forms.Button(); - this.textBox1 = new System.Windows.Forms.TextBox(); 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.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // button1 // - this.button1.Location = new System.Drawing.Point(0, 0); + this.button1.Location = new System.Drawing.Point(344, 65); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(120, 40); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(625, 143); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(100, 20); - this.textBox1.TabIndex = 1; - // // richTextBox1 // - this.richTextBox1.Location = new System.Drawing.Point(145, 111); + this.richTextBox1.Location = new System.Drawing.Point(12, 217); this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(381, 316); + this.richTextBox1.Size = new System.Drawing.Size(215, 211); this.richTextBox1.TabIndex = 2; this.richTextBox1.Text = ""; // // panel1 // - this.panel1.BackColor = System.Drawing.Color.Firebrick; - this.panel1.Location = new System.Drawing.Point(0, 385); + this.panel1.BackColor = System.Drawing.Color.LightGray; + this.panel1.Location = new System.Drawing.Point(721, 43); + this.panel1.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(55, 55); + this.panel1.Size = new System.Drawing.Size(70, 70); this.panel1.TabIndex = 3; - 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); // - // Form1 + // 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); + this.flowLayoutPanel1.Controls.Add(this.panel3); + this.flowLayoutPanel1.Controls.Add(this.panel4); + this.flowLayoutPanel1.Controls.Add(this.panel5); + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel1.Location = new System.Drawing.Point(261, 143); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(231, 238); + 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; + // + // panel4 + // + this.panel4.BackColor = System.Drawing.Color.LightGray; + this.panel4.Location = new System.Drawing.Point(3, 149); + this.panel4.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(70, 70); + this.panel4.TabIndex = 6; + // + // 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; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Location = new System.Drawing.Point(535, 143); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(209, 247); + this.tableLayoutPanel1.TabIndex = 7; + // + // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 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, 441); + this.ClientSize = new System.Drawing.Size(800, 440); + 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.textBox1); this.Controls.Add(this.button1); - this.Name = "Form1"; + this.Name = "MainForm"; this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.flowLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); - this.PerformLayout(); } #endregion private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox textBox1; 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; } } diff --git a/MainForm.cs b/MainForm.cs index d61d569..f2e5dbb 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -1,4 +1,5 @@ -using System; +using AppLauncher.Windows.Forms; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -12,114 +13,21 @@ using System.Windows.Forms; namespace AppLauncher { - public partial class MainForm : Form + public partial class MainForm : AForm { - private bool windowDragging = false; - private Point windowOffset = new Point(); - public MainForm() + public MainForm() : base() { InitializeComponent(); - this.FormBorderStyle = FormBorderStyle.None; - this.StartPosition = FormStartPosition.Manual; - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - int requestedHeight = (int)Math.Floor(decimal.Divide((Screen.PrimaryScreen.WorkingArea.Height - this.Height), 2)); - - this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, (Screen.PrimaryScreen.WorkingArea.Y + requestedHeight)); - - - - //foreach (Screen item in Screen.AllScreens) - //{ - // richTextBox1.Text += item.Bounds.ToString() + Environment.NewLine; - // richTextBox1.Text += item.WorkingArea.ToString() + Environment.NewLine; - - // richTextBox1.Text += Environment.NewLine; - //} - - } - - //protected override void OnLocationChanged(EventArgs e) - //{ - // base.OnLocationChanged(e); - - // this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, this.Location.Y); - //} - - protected override void OnPaintBackground(PaintEventArgs e) - { - base.OnPaintBackground(e); - - //Graphics g = e.Graphics; - //g.TextRenderingHint = TextRenderingHint.AntiAlias; - //g.InterpolationMode = InterpolationMode.HighQualityBilinear; - //g.PixelOffsetMode = PixelOffsetMode.HighQuality; - //g.SmoothingMode = SmoothingMode.HighQuality; - - //g.FillRectangle(new LinearGradientBrush(this.DisplayRectangle, Color.FromArgb(76, 83, 93), Color.FromArgb(255, 255, 255), -30F), this.DisplayRectangle); + pictureBox1.MouseDown += windowMoveControl_MouseDown; + pictureBox1.MouseUp += windowMoveControl_MouseUp; + pictureBox1.MouseMove += windowMoveControl_MouseMove; } - //protected override void OnPaintBackground(PaintEventArgs e) - //{ - // // do nothing - //} - //protected override void OnPaint(PaintEventArgs e) - //{ - // base.OnPaint(e); - - // if (this.BackgroundImage == null) - // { - // return; - // } - - // Graphics g = e.Graphics; - - // g.TextRenderingHint = TextRenderingHint.AntiAlias; - // g.InterpolationMode = InterpolationMode.HighQualityBilinear; - // g.PixelOffsetMode = PixelOffsetMode.HighQuality; - // g.SmoothingMode = SmoothingMode.HighQuality; - - // g.DrawImage(this.BackgroundImage, Point.Empty); - //} - - private void panel1_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - windowDragging = true; - windowOffset = e.Location; - } - - private void panel1_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - } - - private void panel1_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - Point pos = this.PointToScreen(e.Location); - //this.Location = new Point(currentScreenPos.X - windowOffset.X, currentScreenPos.Y - windowOffset.Y); - - 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); - } - } //private void Form1_MouseDown(object sender, MouseEventArgs e) //{ diff --git a/MainForm.resx b/MainForm.resx index 1af7de1..04cf4c4 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -117,4 +117,13 @@ 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/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index c2949fb..9aaf4aa 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -59,5 +59,15 @@ namespace AppLauncher.Properties { resourceCulture = value; } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap grid_ea { + get { + object obj = ResourceManager.GetObject("grid_ea", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 1af7de1..c516ffd 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -117,4 +117,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\grid-ea.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Resources/grid-ea.png b/Resources/grid-ea.png new file mode 100644 index 0000000..34c64e0 Binary files /dev/null and b/Resources/grid-ea.png differ diff --git a/Resources/raw/grid.svg b/Resources/raw/grid.svg new file mode 100644 index 0000000..20de206 --- /dev/null +++ b/Resources/raw/grid.svg @@ -0,0 +1,96 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/Windows/Forms/AForm.cs b/Windows/Forms/AForm.cs new file mode 100644 index 0000000..40e0b82 --- /dev/null +++ b/Windows/Forms/AForm.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Text; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AppLauncher.Windows.Forms +{ + public class AForm : Form + { + private bool windowDragging = false; + private Point windowOffset = new Point(); + + public AForm() : base() + { + if (!this.DesignMode) + { + this.FormBorderStyle = FormBorderStyle.None; + this.StartPosition = FormStartPosition.Manual; + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + if (this.DesignMode) + { + return; + } + + int requestedHeight = (int)Math.Floor(decimal.Divide((Screen.PrimaryScreen.WorkingArea.Height - this.Height), 2)); + + this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, (Screen.PrimaryScreen.WorkingArea.Y + requestedHeight)); + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + base.OnPaintBackground(e); + + Graphics g = e.Graphics; + g.TextRenderingHint = TextRenderingHint.AntiAlias; + g.InterpolationMode = InterpolationMode.HighQualityBilinear; + g.PixelOffsetMode = PixelOffsetMode.HighQuality; + g.SmoothingMode = SmoothingMode.HighQuality; + + //g.FillRectangle(new LinearGradientBrush(this.DisplayRectangle, Color.FromArgb(76, 83, 93), Color.FromArgb(255, 255, 255), -30F), this.DisplayRectangle); + + //g.DrawRectangle(new Pen(new SolidBrush(Color.Red), 1), this.DisplayRectangle); + } + + //protected override void OnPaint(PaintEventArgs e) + //{ + // base.OnPaint(e); + + // if (this.BackgroundImage == null) + // { + // return; + // } + + // Graphics g = e.Graphics; + + // g.TextRenderingHint = TextRenderingHint.AntiAlias; + // g.InterpolationMode = InterpolationMode.HighQualityBilinear; + // g.PixelOffsetMode = PixelOffsetMode.HighQuality; + // g.SmoothingMode = SmoothingMode.HighQuality; + + // g.DrawImage(this.BackgroundImage, Point.Empty); + //} + + protected void windowMoveControl_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) + { + return; + } + + windowDragging = true; + windowOffset = e.Location; + } + + 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); + + 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); + } + } + + } +}