Changed: heading panel user control

This commit is contained in:
Ray 2020-03-28 22:48:06 +00:00
parent db349781e1
commit 5979aa1a3f
8 changed files with 335 additions and 73 deletions

View File

@ -60,6 +60,12 @@
<Compile Include="Windows\Forms\AForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Forms\HeadingPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Windows\Forms\HeadingPanel.Designer.cs">
<DependentUpon>HeadingPanel.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
@ -73,6 +79,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Windows\Forms\HeadingPanel.resx">
<DependentUpon>HeadingPanel.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -86,5 +95,6 @@
<ItemGroup>
<None Include="Resources\grid-ea.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

51
MainForm.Designer.cs generated
View File

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

View File

@ -20,9 +20,6 @@ namespace AppLauncher
{
InitializeComponent();
pictureBox1.MouseDown += windowMoveControl_MouseDown;
pictureBox1.MouseUp += windowMoveControl_MouseUp;
pictureBox1.MouseMove += windowMoveControl_MouseMove;
}

View File

@ -117,13 +117,4 @@
<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

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

88
Windows/Forms/HeadingPanel.Designer.cs generated Normal file
View File

@ -0,0 +1,88 @@
namespace AppLauncher.Windows.Forms
{
partial class HeadingPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

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

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<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>