diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-11-04 08:51:38 +0000 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-11-04 08:51:38 +0000 |
| commit | 2a473d05a34afe51cf0f5340cbdd48ad4e771657 (patch) | |
| tree | cb56388b842b65876e237c957b33c71ca31d1836 /Histacom2.Engine | |
| parent | 81cde79fccd0b46e5af1109968f16f5249b27555 (diff) | |
| download | histacom2-2a473d05a34afe51cf0f5340cbdd48ad4e771657.tar.gz histacom2-2a473d05a34afe51cf0f5340cbdd48ad4e771657.tar.bz2 histacom2-2a473d05a34afe51cf0f5340cbdd48ad4e771657.zip | |
ClassicDropDown + ClassicTextBox!
Finally! It only took 2 months...
Diffstat (limited to 'Histacom2.Engine')
| -rw-r--r-- | Histacom2.Engine/Histacom2.Engine.csproj | 19 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/DropDownItem.Designer.cs | 63 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/DropDownItem.cs | 42 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/DropDownItem.resx | 120 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/DropDownOverlay.Designer.cs | 64 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/DropDownOverlay.cs | 26 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/DropDownOverlay.resx | 120 | ||||
| -rw-r--r-- | Histacom2.Engine/UI/ClassicDropDown.Designer.cs | 30 | ||||
| -rw-r--r-- | Histacom2.Engine/UI/ClassicDropDown.cs | 82 | ||||
| -rw-r--r-- | Histacom2.Engine/UI/ClassicTextbox.cs | 12 | ||||
| -rw-r--r-- | Histacom2.Engine/UI/OldClassicTextbox.cs | 77 |
11 files changed, 557 insertions, 98 deletions
diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index bb10572..46d7427 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -54,6 +54,18 @@ <Compile Include="Paintbrush.cs" /> <Compile Include="SaveSystem.cs" /> <Compile Include="TaskBarController.cs" /> + <Compile Include="Template\DropDownItem.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Template\DropDownItem.Designer.cs"> + <DependentUpon>DropDownItem.cs</DependentUpon> + </Compile> + <Compile Include="Template\DropDownOverlay.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Template\DropDownOverlay.Designer.cs"> + <DependentUpon>DropDownOverlay.cs</DependentUpon> + </Compile> <Compile Include="Template\ResizeOverlay.cs"> <SubType>Form</SubType> </Compile> @@ -112,7 +124,6 @@ <Compile Include="UI\ClassicTextBox.Designer.cs"> <DependentUpon>ClassicTextBox.cs</DependentUpon> </Compile> - <Compile Include="UI\OldClassicTextbox.cs" /> <Compile Include="UI\IProgressBar.cs"> <SubType>Component</SubType> </Compile> @@ -130,6 +141,12 @@ <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> + <EmbeddedResource Include="Template\DropDownItem.resx"> + <DependentUpon>DropDownItem.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Template\DropDownOverlay.resx"> + <DependentUpon>DropDownOverlay.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Template\ResizeOverlay.resx"> <DependentUpon>ResizeOverlay.cs</DependentUpon> </EmbeddedResource> diff --git a/Histacom2.Engine/Template/DropDownItem.Designer.cs b/Histacom2.Engine/Template/DropDownItem.Designer.cs new file mode 100644 index 0000000..1318726 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownItem.Designer.cs @@ -0,0 +1,63 @@ +namespace Histacom2.Engine.Template +{ + partial class DropDownItem + { + /// <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.SuspendLayout(); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(315, 20); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; + this.label1.Click += new System.EventHandler(this.label1_Click); + this.label1.MouseEnter += new System.EventHandler(this.label1_MouseEnter); + this.label1.MouseLeave += new System.EventHandler(this.label1_MouseLeave); + // + // DropDownItem + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.label1); + this.Name = "DropDownItem"; + this.Size = new System.Drawing.Size(315, 20); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/Histacom2.Engine/Template/DropDownItem.cs b/Histacom2.Engine/Template/DropDownItem.cs new file mode 100644 index 0000000..8b2c654 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownItem.cs @@ -0,0 +1,42 @@ +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 Histacom2.Engine.Template +{ + public partial class DropDownItem : UserControl + { + public UI.ClassicDropDown dpdw; + public DropDownItem() + { + InitializeComponent(); + } + + public void ChangeText(string newText, Font fnt) + { + label1.Font = fnt; + label1.Text = newText; + } + + private void label1_MouseLeave(object sender, EventArgs e) + { + label1.BackColor = Color.Transparent; + } + + private void label1_Click(object sender, EventArgs e) + { + dpdw.ChooseItem(label1.Text); + } + + private void label1_MouseEnter(object sender, EventArgs e) + { + label1.BackColor = Color.Blue; + } + } +} diff --git a/Histacom2.Engine/Template/DropDownItem.resx b/Histacom2.Engine/Template/DropDownItem.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownItem.resx @@ -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>
\ No newline at end of file diff --git a/Histacom2.Engine/Template/DropDownOverlay.Designer.cs b/Histacom2.Engine/Template/DropDownOverlay.Designer.cs new file mode 100644 index 0000000..6894433 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownOverlay.Designer.cs @@ -0,0 +1,64 @@ +namespace Histacom2.Engine.Template +{ + partial class DropDownOverlay + { + /// <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 Windows Form 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.outline = new System.Windows.Forms.Panel(); + this.SuspendLayout(); + // + // outline + // + this.outline.BackColor = System.Drawing.Color.White; + this.outline.Location = new System.Drawing.Point(230, 56); + this.outline.Name = "outline"; + this.outline.Size = new System.Drawing.Size(200, 100); + this.outline.TabIndex = 0; + this.outline.Paint += new System.Windows.Forms.PaintEventHandler(this.outline_Paint); + // + // DropDownOverlay + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1))))); + this.ClientSize = new System.Drawing.Size(628, 210); + this.Controls.Add(this.outline); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "DropDownOverlay"; + this.Text = "DropDownOverlay"; + this.TopMost = true; + this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1))))); + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.ResumeLayout(false); + + } + + #endregion + + public System.Windows.Forms.Panel outline; + } +}
\ No newline at end of file diff --git a/Histacom2.Engine/Template/DropDownOverlay.cs b/Histacom2.Engine/Template/DropDownOverlay.cs new file mode 100644 index 0000000..4d364d6 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownOverlay.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Histacom2.Engine.Template +{ + public partial class DropDownOverlay : Form + { + public DropDownOverlay() + { + InitializeComponent(); + } + + private void outline_Paint(object sender, PaintEventArgs e) + { + e.Graphics.DrawRectangle(Pens.Black, 0, 0, outline.Width - 1, outline.Height - 1); // Draws a 1 pixel border around the dropdown's drop area! + if (SaveSystem.currentTheme != null) outline.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + } + } +} diff --git a/Histacom2.Engine/Template/DropDownOverlay.resx b/Histacom2.Engine/Template/DropDownOverlay.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownOverlay.resx @@ -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>
\ No newline at end of file diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs index da54d6e..509c04d 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -29,12 +29,12 @@ private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.dropDownSwitch = new System.Windows.Forms.PictureBox(); this.tborder = new System.Windows.Forms.PictureBox(); this.bborder = new System.Windows.Forms.PictureBox(); this.rborder = new System.Windows.Forms.PictureBox(); this.lborder = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dropDownSwitch)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tborder)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bborder)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rborder)).BeginInit(); @@ -50,16 +50,17 @@ this.textBox1.Size = new System.Drawing.Size(96, 13); this.textBox1.TabIndex = 9; // - // pictureBox1 + // dropDownSwitch // - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Right; - this.pictureBox1.Image = global::Histacom2.Engine.Properties.Resources.ClassicDropDownButton; - this.pictureBox1.Location = new System.Drawing.Point(82, 2); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(16, 16); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.pictureBox1.TabIndex = 10; - this.pictureBox1.TabStop = false; + this.dropDownSwitch.Dock = System.Windows.Forms.DockStyle.Right; + this.dropDownSwitch.Image = global::Histacom2.Engine.Properties.Resources.ClassicDropDownButton; + this.dropDownSwitch.Location = new System.Drawing.Point(82, 2); + this.dropDownSwitch.Name = "dropDownSwitch"; + this.dropDownSwitch.Size = new System.Drawing.Size(16, 16); + this.dropDownSwitch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.dropDownSwitch.TabIndex = 10; + this.dropDownSwitch.TabStop = false; + this.dropDownSwitch.Click += new System.EventHandler(this.dropDownSwitch_Click); // // tborder // @@ -101,7 +102,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.dropDownSwitch); this.Controls.Add(this.textBox1); this.Controls.Add(this.tborder); this.Controls.Add(this.bborder); @@ -109,7 +110,8 @@ this.Controls.Add(this.lborder); this.Name = "ClassicDropDown"; this.Size = new System.Drawing.Size(100, 20); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.Load += new System.EventHandler(this.ClassicDropDown_Load); + ((System.ComponentModel.ISupportInitialize)(this.dropDownSwitch)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tborder)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rborder)).EndInit(); @@ -126,6 +128,6 @@ private System.Windows.Forms.PictureBox bborder; private System.Windows.Forms.PictureBox rborder; private System.Windows.Forms.PictureBox lborder; - private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.PictureBox dropDownSwitch; } } diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index b26862e..0b56cb9 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -7,22 +7,28 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Histacom2.Engine.Template; namespace Histacom2.Engine.UI { public partial class ClassicDropDown : UserControl { + public DropDownOverlay thisOverlay = new DropDownOverlay(); public bool UseSystemPasswordChar { get; set; } + public bool dropDownShown; public static Color textboxcolor = Color.Black; public static Color _lightBack = Color.Silver; public static Color _darkBack = Color.Silver; + public List<string> items = new List<string> { "TestItem" }; + public ClassicDropDown() { InitializeComponent(); + try { // Draw the border @@ -30,20 +36,26 @@ namespace Histacom2.Engine.UI this.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => { // Update a bunch of variables! - textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - if (SaveSystem.currentTheme != null) textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else textBox1.BackColor = Color.White; + textBox1.Font = Font; if (SaveSystem.currentTheme != null) { + textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + BackColor = SaveSystem.currentTheme.threeDObjectsColor; + textboxcolor = SaveSystem.currentTheme.windowColor; _lightBack = Paintbrush.GetLightFromColor(textboxcolor); _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); } + else + { + textBox1.BackColor = Color.White; + BackColor = Color.White; + } }); + tborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => { @@ -77,5 +89,67 @@ namespace Histacom2.Engine.UI } catch { } } + + public void ChooseItem(string str) + { + textBox1.Text = str; + ShowHideDropDown(); + } + + public void ShowHideDropDown() + { + if (dropDownShown) + { + thisOverlay.Close(); + dropDownShown = false; + } else { + thisOverlay = new DropDownOverlay(); + int applyHeight = 0; + foreach (string str in items) + { + DropDownItem itm = new DropDownItem(); + itm.ChangeText(str, Font); + itm.dpdw = this; + itm.Dock = DockStyle.Top; + applyHeight += itm.Height; + thisOverlay.outline.Controls.Add(itm); + } + thisOverlay.outline.Location = this.PointToScreen(Point.Empty); + thisOverlay.outline.Top += this.Height; + thisOverlay.outline.Size = new Size(this.Width, applyHeight); + + thisOverlay.Deactivate += (sender2, e2) => { thisOverlay.Close(); dropDownShown = false; }; + + thisOverlay.Show(); + dropDownShown = true; + } + } + + private void dropDownSwitch_Click(object sender, EventArgs e) + { + ShowHideDropDown(); + } + + private void ClassicDropDown_Load(object sender, EventArgs e) + { + try + { + ((Form)this.TopLevelControl).FormClosed += (sender2, e2) => { thisOverlay.Close(); }; + ((Form)this.TopLevelControl).Resize += (sender2, e2) => + { + thisOverlay.outline.Location = this.PointToScreen(Point.Empty); + thisOverlay.outline.Top += this.Height; + thisOverlay.BringToFront(); + }; + + ((Form)this.TopLevelControl).Move += (sender2, e2) => + { + thisOverlay.outline.Location = this.PointToScreen(Point.Empty); + thisOverlay.outline.Top += this.Height; + thisOverlay.BringToFront(); + }; + } catch { } + + } } } diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs index a42c2b1..8f1f9c3 100644 --- a/Histacom2.Engine/UI/ClassicTextbox.cs +++ b/Histacom2.Engine/UI/ClassicTextbox.cs @@ -32,8 +32,16 @@ namespace Histacom2.Engine.UI // Update a bunch of variables! textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - if (SaveSystem.currentTheme != null) textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else textBox1.BackColor = Color.White; + if (SaveSystem.currentTheme != null) + { + textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + BackColor = SaveSystem.currentTheme.threeDObjectsColor; + } + else + { + textBox1.BackColor = Color.White; + BackColor = Color.White; + } if (SaveSystem.currentTheme != null) { diff --git a/Histacom2.Engine/UI/OldClassicTextbox.cs b/Histacom2.Engine/UI/OldClassicTextbox.cs deleted file mode 100644 index f7db87d..0000000 --- a/Histacom2.Engine/UI/OldClassicTextbox.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Histacom2.Engine.UI -{ - //public class OldClassicTextbox : Control - //{ - // private System.ComponentModel.IContainer components = null; - // public TextBox tb = new TextBox(); - // public bool UseSystemPasswordChar { get; set; } - - // public ClassicTextbox() : base() - // { - // // A bunch of designer stuff! - // this.components = new System.ComponentModel.Container(); - // this.SuspendLayout(); - - // if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - // else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - // tb.Name = "mainText"; - // tb.Location = new Point(3, 3); - // tb.Size = new Size(Size.Width - 6, Size.Height - 6); - // tb.BorderStyle = BorderStyle.None; - // Controls.Add(tb); - - // this.ResumeLayout(false); - // } - - // protected override void Dispose(bool disposing) - // { - // if (disposing && (components != null)) - // { - // components.Dispose(); - // } - // base.Dispose(disposing); - // } - - // protected override void OnPaint(PaintEventArgs e) - // { - - // var textboxcolor = Color.Silver; - // if (SaveSystem.currentTheme != null) textboxcolor = SaveSystem.currentTheme.windowColor; - - // if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; - // else BackColor = Color.White; - - // var _lightBack = Paintbrush.GetLightFromColor(textboxcolor); - // var _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); - - // if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - // else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - // var g = e.Graphics; - // g.Clear(BackColor); - - // g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - // if (UseSystemPasswordChar) g.DrawString(new string('●', Text.Length), Font, Brushes.Black, 3, 3); - // else g.DrawString(Text, Font, Brushes.Black, 3, 3); - - // g.DrawLine(new Pen(_darkBack), 0, 0, Width - 2, 0); - // g.DrawLine(new Pen(_lightBack), Width - 1, 0, Width - 1, Height - 1); - // g.DrawLine(new Pen(_lightBack), 0, Height - 1, Width - 1, Height - 1); - // g.DrawLine(new Pen(_darkBack), 0, 0, 0, Height - 2); - // g.DrawLine(Pens.Black, 1, 1, Width - 3, 1); - // g.DrawLine(Pens.Black, 1, 1, 1, Height - 3); - // g.DrawLine(new Pen(textboxcolor), 1, Height - 2, Width - 2, Height - 2); - // g.DrawLine(new Pen(textboxcolor), Width - 2, Height - 2, Width - 2, 1); - - // base.OnPaint(e); - // } -} |
