WIP: custom user control base

This commit is contained in:
Ray 2020-03-30 11:48:24 +01:00
parent 2302074408
commit 42dca92454
8 changed files with 413 additions and 9 deletions

View File

@ -60,12 +60,21 @@
<Compile Include="Windows\Forms\AForm.cs"> <Compile Include="Windows\Forms\AForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Windows\Forms\AUserControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Windows\Forms\HeadingPanel.cs"> <Compile Include="Windows\Forms\HeadingPanel.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<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\TilePanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Windows\Forms\TilePanel.Designer.cs">
<DependentUpon>TilePanel.cs</DependentUpon>
</Compile>
<Compile Include="Windows\Forms\TitlePanel.cs"> <Compile Include="Windows\Forms\TitlePanel.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@ -88,6 +97,9 @@
<EmbeddedResource Include="Windows\Forms\HeadingPanel.resx"> <EmbeddedResource Include="Windows\Forms\HeadingPanel.resx">
<DependentUpon>HeadingPanel.cs</DependentUpon> <DependentUpon>HeadingPanel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\TilePanel.resx">
<DependentUpon>TilePanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\TitlePanel.resx"> <EmbeddedResource Include="Windows\Forms\TitlePanel.resx">
<DependentUpon>TitlePanel.cs</DependentUpon> <DependentUpon>TitlePanel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

82
MainForm.Designer.cs generated
View File

@ -48,6 +48,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.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.panel16 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.tilePanel1 = new AppLauncher.Windows.Forms.TilePanel();
this.tilePanel2 = new AppLauncher.Windows.Forms.TilePanel();
this.flowLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -120,6 +125,8 @@
// //
// headingPanel1 // headingPanel1
// //
this.headingPanel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.headingPanel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.headingPanel1.Checked = false; this.headingPanel1.Checked = false;
this.headingPanel1.Location = new System.Drawing.Point(12, 64); this.headingPanel1.Location = new System.Drawing.Point(12, 64);
this.headingPanel1.MinimumSize = new System.Drawing.Size(100, 20); this.headingPanel1.MinimumSize = new System.Drawing.Size(100, 20);
@ -250,6 +257,71 @@
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;
// //
// button2
//
this.button2.Location = new System.Drawing.Point(160, 340);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(78, 40);
this.button2.TabIndex = 21;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// 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;
//
// 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;
//
// tilePanel1
//
this.tilePanel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.tilePanel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.tilePanel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.tilePanel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234)))));
this.tilePanel1.IconImage = global::AppLauncher.Properties.Resources.mail_ea_32;
this.tilePanel1.Location = new System.Drawing.Point(321, 236);
this.tilePanel1.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.tilePanel1.MaximumSize = new System.Drawing.Size(70, 70);
this.tilePanel1.MinimumSize = new System.Drawing.Size(70, 70);
this.tilePanel1.Name = "tilePanel1";
this.tilePanel1.Size = new System.Drawing.Size(70, 70);
this.tilePanel1.TabIndex = 24;
this.tilePanel1.TitleText = "Mail";
//
// tilePanel2
//
this.tilePanel2.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.tilePanel2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.tilePanel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.tilePanel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234)))));
this.tilePanel2.IconImage = global::AppLauncher.Properties.Resources.mail_ea_32;
this.tilePanel2.Location = new System.Drawing.Point(394, 236);
this.tilePanel2.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.tilePanel2.MaximumSize = new System.Drawing.Size(70, 70);
this.tilePanel2.MinimumSize = new System.Drawing.Size(70, 70);
this.tilePanel2.Name = "tilePanel2";
this.tilePanel2.Size = new System.Drawing.Size(70, 70);
this.tilePanel2.TabIndex = 25;
this.tilePanel2.TitleText = "Mail";
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -257,6 +329,11 @@
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.tilePanel2);
this.Controls.Add(this.tilePanel1);
this.Controls.Add(this.label1);
this.Controls.Add(this.panel16);
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);
this.Controls.Add(this.panel14); this.Controls.Add(this.panel14);
@ -303,6 +380,11 @@
private System.Windows.Forms.Panel panel13; private System.Windows.Forms.Panel panel13;
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.Panel panel16;
private System.Windows.Forms.Label label1;
private Windows.Forms.TilePanel tilePanel1;
private Windows.Forms.TilePanel tilePanel2;
} }
} }

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Text; using System.Drawing.Text;
@ -46,6 +47,15 @@ namespace AppLauncher
} }
private void button2_Click(object sender, EventArgs e)
{
ProcessStartInfo process = new ProcessStartInfo();
process.FileName = @"C:\B\Portable Files (pure)\Build and Deploy Utility\v0.2.0.046 alpha\badutil.exe";
process.Verb = "runas";
Process.Start(process);
}

View File

@ -0,0 +1,75 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms
{
public class AUserControl : UserControl
{
public AUserControl() : base()
{
}
[Browsable(false)]
public override Image BackgroundImage { get => base.BackgroundImage; set => base.BackgroundImage = value; }
[Browsable(false)]
public override ImageLayout BackgroundImageLayout { get => base.BackgroundImageLayout; set => base.BackgroundImageLayout = value; }
[Browsable(false)]
public new BorderStyle BorderStyle { get => base.BorderStyle; set => base.BorderStyle = value; }
[Browsable(false)]
public override Cursor Cursor { get => base.Cursor; set => base.Cursor = value; }
[Browsable(false)]
public override Font Font { get => base.Font; set => base.Font = value; }
[Browsable(false)]
public override Color ForeColor { get => base.ForeColor; set => base.ForeColor = value; }
[Browsable(false)]
public override RightToLeft RightToLeft { get => base.RightToLeft; set => base.RightToLeft = value; }
[Browsable(false)]
public new bool UseWaitCursor { get => base.UseWaitCursor; set => base.UseWaitCursor = value; }
[Browsable(false)]
public override bool AllowDrop { get => base.AllowDrop; set => base.AllowDrop = value; }
[Browsable(false)]
public override AutoValidate AutoValidate { get => base.AutoValidate; set => base.AutoValidate = value; }
[Browsable(false)]
public override ContextMenuStrip ContextMenuStrip { get => base.ContextMenuStrip; set => base.ContextMenuStrip = value; }
[Browsable(false)]
public new ImeMode ImeMode { get => base.ImeMode; set => base.ImeMode = value; }
[Browsable(false)]
public override bool AutoScroll { get => base.AutoScroll; set => base.AutoScroll = value; }
[Browsable(false)]
public new Size AutoScrollMargin { get => base.AutoScrollMargin; set => base.AutoScrollMargin = value; }
[Browsable(false)]
public new Size AutoScrollMinSize { get => base.AutoScrollMinSize; set => base.AutoScrollMinSize = value; }
[Browsable(false)]
public override bool AutoSize { get => base.AutoSize; set => base.AutoSize = value; }
[Browsable(false)]
public new AutoSizeMode AutoSizeMode { get => base.AutoSizeMode; set => base.AutoSizeMode = value; }
[Browsable(false)]
public override Size MaximumSize { get => base.MaximumSize; set => base.MaximumSize = value; }
[Browsable(false)]
public override Size MinimumSize { get => base.MinimumSize; set => base.MinimumSize = value; }
}
}

View File

@ -1,13 +1,12 @@
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms;
namespace AppLauncher.Windows.Forms namespace AppLauncher.Windows.Forms
{ {
public partial class HeadingPanel : UserControl public partial class HeadingPanel : AUserControl
{ {
protected bool isChecked = false; protected bool isChecked = false;
public HeadingPanel() public HeadingPanel() : base()
{ {
InitializeComponent(); InitializeComponent();
@ -15,11 +14,7 @@ namespace AppLauncher.Windows.Forms
} }
[Category("Appearance"), Browsable(true)] [Category("Appearance"), Browsable(true)]
public string TitleText public string TitleText { get => label1.Text; set => label1.Text = value; }
{
get => label1.Text;
set => label1.Text = value;
}
[Category("Appearance"), Browsable(true)] [Category("Appearance"), Browsable(true)]
public bool Checked public bool Checked
@ -30,7 +25,6 @@ namespace AppLauncher.Windows.Forms
isChecked = value; isChecked = value;
pictureBox1.BackgroundImage = (value) ? Properties.Resources.toggle_right_ea_16 : Properties.Resources.toggle_left_ea_16; pictureBox1.BackgroundImage = (value) ? Properties.Resources.toggle_right_ea_16 : Properties.Resources.toggle_left_ea_16;
} }
} }

84
Windows/Forms/TilePanel.Designer.cs generated Normal file
View File

@ -0,0 +1,84 @@
namespace AppLauncher.Windows.Forms
{
partial class TilePanel
{
/// <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()
{
this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// 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(0, 47);
this.label1.Margin = new System.Windows.Forms.Padding(0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 13);
this.label1.TabIndex = 24;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.pictureBox1.ErrorImage = null;
this.pictureBox1.InitialImage = null;
this.pictureBox1.Location = new System.Drawing.Point(0, 8);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(70, 38);
this.pictureBox1.TabIndex = 25;
this.pictureBox1.TabStop = false;
//
// TilePanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.label1);
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234)))));
this.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
this.MaximumSize = new System.Drawing.Size(70, 70);
this.MinimumSize = new System.Drawing.Size(70, 70);
this.Name = "TilePanel";
this.Size = new System.Drawing.Size(70, 70);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

View File

@ -0,0 +1,27 @@
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 TilePanel : AUserControl
{
public TilePanel() : base()
{
InitializeComponent();
}
[Category("Appearance"), Browsable(true)]
public string TitleText { get => label1.Text; set => label1.Text = value; }
[Category("Appearance"), Browsable(true)]
public Image IconImage { get => pictureBox1.BackgroundImage; set => pictureBox1.BackgroundImage = value; }
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>