WIP: design ideas

This commit is contained in:
Ray 2020-03-28 02:54:08 +00:00
parent 3f6d36dbdb
commit db349781e1
9 changed files with 358 additions and 122 deletions

View File

@ -57,6 +57,9 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Windows\Forms\AForm.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
@ -80,5 +83,8 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Resources\grid-ea.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

144
MainForm.Designer.cs generated
View File

@ -28,71 +28,169 @@
/// </summary>
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;
}
}

View File

@ -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)
//{

View File

@ -117,4 +117,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBox1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAS
cwAAEnMBjCK5BwAAAHNJREFUSEvtlLENgDAMBL3/WtkmS4ARzhcmsXQFBSgnfZO/F0pB7D/03pvnKNJC
Ra6YSI+EilyxLJzcEVeQEXEFGRFXkBFxBRkRV4yiSqjIFX747n/wfa5rpWvm7Kdif+Bm2ZERccUoqoSK
XOGH+6mYYHYCNMlBzlYWbSwAAAAASUVORK5CYII=
</value>
</data>
</root>

View File

@ -59,5 +59,15 @@ namespace AppLauncher.Properties {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap grid_ea {
get {
object obj = ResourceManager.GetObject("grid_ea", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -117,4 +117,8 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="grid_ea" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\grid-ea.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

BIN
Resources/grid-ea.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

96
Resources/raw/grid.svg Normal file
View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
class="feather feather-grid"
version="1.1"
id="svg1176"
sodipodi:docname="grid.svg"
inkscape:export-filename="L:\gitlab-hiimray\linear-app-launcher\Resources\grid.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
style="fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round">
<metadata
id="metadata1182">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs1180" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1017"
id="namedview1178"
showgrid="false"
inkscape:zoom="17.666667"
inkscape:cx="-1.0506596"
inkscape:cy="1.9195642"
inkscape:window-x="1072"
inkscape:window-y="843"
inkscape:window-maximized="1"
inkscape:current-layer="svg1176" />
<rect
x="2.7877357"
y="2.7877357"
width="5.5141511"
height="5.5141511"
id="rect1168"
inkscape:export-filename="L:\gitlab-hiimray\linear-app-launcher\Resources\rect1168.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120"
style="fill:none;fill-opacity:1;stroke:#eaeaea;stroke-width:1.57547164;stroke-opacity:1" />
<rect
x="11.45283"
y="2.7877357"
width="5.5141511"
height="5.5141511"
id="rect1170"
inkscape:export-filename="L:\gitlab-hiimray\linear-app-launcher\Resources\rect1168.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120"
style="fill:none;fill-opacity:1;stroke:#eaeaea;stroke-width:1.57547164;stroke-opacity:1" />
<rect
x="11.45283"
y="11.45283"
width="5.5141511"
height="5.5141511"
id="rect1172"
inkscape:export-filename="L:\gitlab-hiimray\linear-app-launcher\Resources\rect1168.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120"
style="fill:none;fill-opacity:1;stroke:#eaeaea;stroke-width:1.57547164;stroke-opacity:1" />
<rect
x="2.7877357"
y="11.45283"
width="5.5141511"
height="5.5141511"
id="rect1174"
inkscape:export-filename="L:\gitlab-hiimray\linear-app-launcher\Resources\rect1168.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120"
style="fill:none;fill-opacity:1;stroke:#eaeaea;stroke-width:1.57547164;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

105
Windows/Forms/AForm.cs Normal file
View File

@ -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);
}
}
}
}