From e5f29e7b53322e11578acd0deb3b1d454998bb77 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Tue, 24 Oct 2017 11:18:12 +0100 Subject: All new ClassicTextBox --- Histacom2.Engine/UI/ClassicDropDown.Designer.cs | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Histacom2.Engine/UI/ClassicDropDown.Designer.cs (limited to 'Histacom2.Engine/UI/ClassicDropDown.Designer.cs') diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs new file mode 100644 index 0000000..2925f72 --- /dev/null +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -0,0 +1,36 @@ +namespace Histacom2.Engine.UI +{ + partial class ClassicDropDown + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} -- cgit v1.2.3 From 72a2b98a29ac1d3b67a4158b6a1823a39ecb5e00 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Tue, 24 Oct 2017 13:50:38 +0100 Subject: Finished ClassicTextBox ClassicDropDown next! --- Histacom2.Engine/UI/ClassicDropDown.Designer.cs | 7 +- Histacom2.Engine/UI/ClassicDropDown.cs | 294 +-------------------- Histacom2.Engine/UI/ClassicTextBox.Designer.cs | 2 - Histacom2.Engine/UI/ClassicTextbox.cs | 7 +- .../Win95Apps/Win95WindowsExplorer.Designer.cs | 29 +- 5 files changed, 26 insertions(+), 313 deletions(-) (limited to 'Histacom2.Engine/UI/ClassicDropDown.Designer.cs') diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs index 2925f72..424ff69 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -2,7 +2,7 @@ { partial class ClassicDropDown { - /// + /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; @@ -22,13 +22,14 @@ #region Component Designer generated code - /// - /// Required method for Designer support - do not modify + /// + /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; } #endregion diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index 85c509a..43e1a65 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -1,306 +1,20 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Drawing; +using System.Data; using System.Linq; -using System.Reflection; -using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Histacom2.Engine.UI { - //public class CustomTextBox : NativeWindow - //{ - // private TextBox parentTextBox; - // private Bitmap bitmap; - // private Graphics textBoxGraphics; - // private Graphics bufferGraphics; - // // this is where we intercept the Paint event for the TextBox at the OS level   - // protected override void WndProc(ref Message m) - // { - // switch (m.Msg) - // { - // case 15: // this is the WM_PAINT message   - // // invalidate the TextBox so that it gets refreshed properly   - // parentTextBox.Invalidate(); - // // call the default win32 Paint method for the TextBox first   - // base.WndProc(ref m); - // // now use our code to draw extra stuff over the TextBox   - // this.CustomPaint(); - // break; - // default: - // base.WndProc(ref m); - // break; - // } - // } - // public CustomTextBox(TextBox textBox) - // { - // this.parentTextBox = textBox; - // this.bitmap = new Bitmap(textBox.Width, textBox.Height); - // this.bufferGraphics = Graphics.FromImage(this.bitmap); - // this.bufferGraphics.Clip = new Region(textBox.ClientRectangle); - // this.textBoxGraphics = Graphics.FromHwnd(textBox.Handle); - // // Start receiving messages (make sure you call ReleaseHandle on Dispose):   - // this.AssignHandle(textBox.Handle); - // } - // private void CustomPaint() - // { - // // code goes here, see below   - // } - //} - - public partial class ClassicDropDown : Control + public partial class ClassicDropDown : UserControl { - public TextBox tb = new TextBox(); - public bool UseSystemPasswordChar { get; set; } - public int CursorPosition { get; set; } - private Timer CursorBlink { get; set; } - private bool _cursorVisible { get; set; } - - public ClassicDropDown() : base() - { - if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - DoubleBuffered = true; - - CursorBlink = new Timer(); - CursorBlink.Interval = 1000; - - // The stuff that make the textbox "work" - - MouseDown += new MouseEventHandler(PerformMouseDown); - MouseUp += new MouseEventHandler(PerformMouseUp); - - PreviewKeyDown += (s, e) => - { - e.IsInputKey = true; - }; - - //KeyDown += new KeyEventHandler(PerformKeyDown); - - // Remove the default textbox paint event so that we can have our own! ACTUALLY, NO! - - //FieldInfo f1 = typeof(Control).GetField("EventPaint", - // BindingFlags.Static | BindingFlags.NonPublic); - //object obj = f1.GetValue(this); - //PropertyInfo pi = GetType().GetProperty("Events", - // BindingFlags.NonPublic | BindingFlags.Instance); - //EventHandlerList list = (EventHandlerList)pi.GetValue(this, null); - //list.RemoveHandler(obj, list[obj]); - - //tb.Paint += new PaintEventHandler(PerformPaint); - //TextChanged += new EventHandler(PerformTextChanged); - //CursorBlink.Tick += new EventHandler(PerformCursorBlink); - - //CursorBlink.Start(); - - // I know it's a bit of a hack but it's all we can really do... - tb.Size = new Size(this.Size.Width - 6, this.Size.Height - 6); - tb.Location = new Point(3, 3); - tb.BorderStyle = BorderStyle.None; - Controls.Add(tb); - - - } - - 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); - - Size textSize = MeasureText(Text.Substring(0, CursorPosition), Font); // Get the width of the text from the begining to the cursor's position so it can draw the cursor. - - if (_cursorVisible) g.DrawLine(new Pen(Color.Gray), textSize.Width + 3, 4, textSize.Width + 3, Height - 4); // This is the caret! - g.DrawImage(Properties.Resources.ClassicDropDownButton, Width - 17, 2); - - base.OnPaint(e); - - } - - private void PerformMouseDown(object sender, MouseEventArgs e) - { - // TextBox: - - base.Focus(); - - // First check if it is in the bounds of the actual box - if (e.X < Width - 18 && e.X > 3 && e.Y > 3 && e.Y < Width - 2) - { - // Now to get where on text you are clicking... this is very tricky because different characters are different widths... - int Sum = 0; - int i = 0; - - foreach (char character in Text) - { - - Sum += MeasureText(character.ToString(), Font).Width; - - if (e.X - 3 <= Sum) break; - - //LastSum = Sum; - i++; - } - - //setCurPos = (Sum == 0) ? Text.Length : Sum; - //if (setCurPos > Text.Length) setCurPos = Text.Length; - CursorPosition = i; // This sets the cursor position! - } - _cursorVisible = true; - - // DropDown: - - - Invalidate(); - } - - private void PerformMouseUp(object sender, MouseEventArgs e) + public ClassicDropDown() { - // DropDown: - - + InitializeComponent(); } - - private void PerformKeyDown(object sender, KeyEventArgs e) - { - // TextBox: - - switch (e.KeyCode) - { - case Keys.Back: - Text = Text.Remove(CursorPosition - 1, 1); - break; - case Keys.Delete: - if (!(CursorPosition > Text.Length + 1)) Text = Text.Remove(CursorPosition, 1); - break; - case Keys.Home: - CursorPosition = 0; - break; - case Keys.End: - CursorPosition = Text.Length; - break; - case Keys.Left: - if (CursorPosition > 0) CursorPosition -= 1; - break; - case Keys.Right: - if (CursorPosition < Text.Length) CursorPosition += 1; - break; - case Keys.Return: - break; - case Keys.Space: - Text = Text.Insert(CursorPosition, " "); - CursorPosition = CursorPosition + 1; - break; - default: - bool caps = false; - - if (e.Shift) caps = true; - if (Control.IsKeyLocked(Keys.CapsLock)) caps = true; - - if (char.IsLetterOrDigit((char)e.KeyCode)) - { - // Now the numbers 1, 2, 3 etc. are "d1", "d2" etc. - STUPID, RIGHT? So now we have to check if it has a number and contains "d". - - bool handled = false; - - if (StrContainsNumber(e.KeyCode.ToString().ToLower())) - { - if (e.KeyCode.ToString().ToLower().Contains("d")) - { - handled = true; - Text = Text.Insert(CursorPosition, e.KeyCode.ToString().Replace("d", "")); - } - } - - if (handled == false) - { - if (caps == false) Text = Text.Insert(CursorPosition, e.KeyCode.ToString().ToLower()); else Text = Text.Insert(CursorPosition, e.KeyCode.ToString().ToUpper()); - } - CursorPosition = CursorPosition + 1; - } - break; - } - - _cursorVisible = true; - Invalidate(); - } - - private void PerformCursorBlink(object sender, EventArgs e) - { - if (_cursorVisible) _cursorVisible = false; - else _cursorVisible = true; - Invalidate(); - } - - private void PerformTextChanged(object sender, EventArgs e) - { - _cursorVisible = true; - if (CursorPosition >= Text.Length) CursorPosition = Text.Length; - Invalidate(); - } - - public static Size MeasureText(string Text, Font Font) - { - TextFormatFlags flags - = TextFormatFlags.Left - | TextFormatFlags.Top - | TextFormatFlags.NoPadding - | TextFormatFlags.NoPrefix; - Size szProposed = new Size(int.MaxValue, int.MaxValue); - Size sz1 = TextRenderer.MeasureText(".", Font, szProposed, flags); - Size sz2 = TextRenderer.MeasureText(Text + ".", Font, szProposed, flags); - return new Size(sz2.Width - sz1.Width, sz2.Height); - } - - public bool StrContainsNumber(string str) - { - foreach (char ch in str) - { - double unused; - if (double.TryParse(ch.ToString(), out unused)) return true; - } - return false; - } - - [DllImport("gdi32.dll")] - private static extern bool BitBlt( -IntPtr hdcDest, // handle to destination DC -int nXDest, // x-coord of destination upper-left corner -int nYDest, // y-coord of destination upper-left corner -int nWidth, // width of destination rectangle -int nHeight, // height of destination rectangle -IntPtr hdcSrc, // handle to source DC -int nXSrc, // x-coordinate of source upper-left corner -int nYSrc, // y-coordinate of source upper-left corner -System.Int32 dwRop // raster operation code -); } } diff --git a/Histacom2.Engine/UI/ClassicTextBox.Designer.cs b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs index 0e7148f..af6b199 100644 --- a/Histacom2.Engine/UI/ClassicTextBox.Designer.cs +++ b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs @@ -93,8 +93,6 @@ this.Controls.Add(this.bborder); this.Controls.Add(this.rborder); this.Controls.Add(this.lborder); - this.MaximumSize = new System.Drawing.Size(0, 17); - this.MinimumSize = new System.Drawing.Size(100, 17); this.Name = "ClassicTextBox"; this.Size = new System.Drawing.Size(100, 17); ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs index 8c1d8d8..a42c2b1 100644 --- a/Histacom2.Engine/UI/ClassicTextbox.cs +++ b/Histacom2.Engine/UI/ClassicTextbox.cs @@ -30,11 +30,10 @@ namespace Histacom2.Engine.UI this.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => { // Update a bunch of variables! - if (SaveSystem.currentTheme != null) textBox1.Font = SaveSystem.currentTheme.buttonFont; - else textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else BackColor = Color.White; + if (SaveSystem.currentTheme != null) textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + else textBox1.BackColor = Color.White; if (SaveSystem.currentTheme != null) { diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 153018a..0f3eee8 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -55,12 +55,12 @@ this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); - this.refresh = new System.Windows.Forms.Timer(this.components); + this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); this.classicButton1 = new Histacom2.Engine.UI.ClassicButton(); this.btnSave = new Histacom2.Engine.UI.ClassicButton(); - this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); + this.refresh = new System.Windows.Forms.Timer(this.components); this.program.SuspendLayout(); this.MenuStrip1.SuspendLayout(); this.pnlSave.SuspendLayout(); @@ -295,10 +295,17 @@ this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // - // refresh + // txtSave // - this.refresh.Interval = 15000; - this.refresh.Tick += new System.EventHandler(this.refresh_Tick); + this.txtSave.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.txtSave.BackColor = System.Drawing.Color.White; + this.txtSave.Location = new System.Drawing.Point(56, 6); + this.txtSave.Name = "txtSave"; + this.txtSave.Size = new System.Drawing.Size(549, 17); + this.txtSave.TabIndex = 22; + this.txtSave.UseSystemPasswordChar = false; // // classicLabel2 // @@ -348,16 +355,10 @@ this.btnSave.Text = "Save"; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // - // txtSave + // refresh // - this.txtSave.BackColor = System.Drawing.Color.White; - this.txtSave.Location = new System.Drawing.Point(56, 6); - this.txtSave.MaximumSize = new System.Drawing.Size(0, 17); - this.txtSave.MinimumSize = new System.Drawing.Size(100, 17); - this.txtSave.Name = "txtSave"; - this.txtSave.Size = new System.Drawing.Size(549, 17); - this.txtSave.TabIndex = 22; - this.txtSave.UseSystemPasswordChar = false; + this.refresh.Interval = 15000; + this.refresh.Tick += new System.EventHandler(this.refresh_Tick); // // Win95WindowsExplorer // -- cgit v1.2.3 From 81cde79fccd0b46e5af1109968f16f5249b27555 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Tue, 24 Oct 2017 13:55:39 +0100 Subject: Started on ClassicDropDown --- Histacom2.Engine/Histacom2.Engine.csproj | 5 +- Histacom2.Engine/UI/ClassicDropDown.Designer.cs | 96 ++++++++++++++++- Histacom2.Engine/UI/ClassicDropDown.cs | 61 +++++++++++ Histacom2.Engine/UI/ClassicDropDown.resx | 120 +++++++++++++++++++++ .../Win95Apps/Win95WindowsExplorer.Designer.cs | 18 +++- 5 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 Histacom2.Engine/UI/ClassicDropDown.resx (limited to 'Histacom2.Engine/UI/ClassicDropDown.Designer.cs') diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index 128f0ab..bb10572 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -95,7 +95,7 @@ Component - Component + UserControl ClassicDropDown.cs @@ -148,6 +148,9 @@ WinXP.cs + + ClassicDropDown.cs + ClassicTextBox.cs diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs index 424ff69..da54d6e 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -28,10 +28,104 @@ /// private void InitializeComponent() { - components = new System.ComponentModel.Container(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.pictureBox1 = 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.tborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.lborder)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(2, 2); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(96, 13); + this.textBox1.TabIndex = 9; + // + // pictureBox1 + // + 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; + // + // tborder + // + this.tborder.Dock = System.Windows.Forms.DockStyle.Top; + this.tborder.Location = new System.Drawing.Point(2, 0); + this.tborder.Name = "tborder"; + this.tborder.Size = new System.Drawing.Size(96, 2); + this.tborder.TabIndex = 8; + this.tborder.TabStop = false; + // + // bborder + // + this.bborder.Dock = System.Windows.Forms.DockStyle.Bottom; + this.bborder.Location = new System.Drawing.Point(2, 18); + this.bborder.Name = "bborder"; + this.bborder.Size = new System.Drawing.Size(96, 2); + this.bborder.TabIndex = 5; + this.bborder.TabStop = false; + // + // rborder + // + this.rborder.Dock = System.Windows.Forms.DockStyle.Right; + this.rborder.Location = new System.Drawing.Point(98, 0); + this.rborder.Name = "rborder"; + this.rborder.Size = new System.Drawing.Size(2, 20); + this.rborder.TabIndex = 7; + this.rborder.TabStop = false; + // + // lborder + // + this.lborder.Dock = System.Windows.Forms.DockStyle.Left; + this.lborder.Location = new System.Drawing.Point(0, 0); + this.lborder.Name = "lborder"; + this.lborder.Size = new System.Drawing.Size(2, 20); + this.lborder.TabIndex = 6; + this.lborder.TabStop = false; + // + // ClassicDropDown + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.tborder); + this.Controls.Add(this.bborder); + this.Controls.Add(this.rborder); + this.Controls.Add(this.lborder); + this.Name = "ClassicDropDown"; + this.Size = new System.Drawing.Size(100, 20); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.lborder)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.PictureBox tborder; + private System.Windows.Forms.PictureBox bborder; + private System.Windows.Forms.PictureBox rborder; + private System.Windows.Forms.PictureBox lborder; + private System.Windows.Forms.PictureBox pictureBox1; } } diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index 43e1a65..b26862e 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -12,9 +12,70 @@ namespace Histacom2.Engine.UI { public partial class ClassicDropDown : UserControl { + public bool UseSystemPasswordChar { get; set; } + + public static Color textboxcolor = Color.Black; + + public static Color _lightBack = Color.Silver; + public static Color _darkBack = Color.Silver; + public ClassicDropDown() { InitializeComponent(); + + try + { + // Draw the border + + 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; + + if (SaveSystem.currentTheme != null) + { + textboxcolor = SaveSystem.currentTheme.windowColor; + + _lightBack = Paintbrush.GetLightFromColor(textboxcolor); + _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); + } + }); + + + tborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_darkBack), 0, 0, tborder.Width, 0); + e.Graphics.DrawLine(Pens.Black, 0, 1, tborder.Width, 1); + + }); + + lborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_darkBack), 0, 0, 0, Height); + e.Graphics.DrawLine(Pens.Black, 1, 0, 1, Height); + }); + + rborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_lightBack), 0, 0, 0, Height - 1); + e.Graphics.DrawLine(new Pen(textboxcolor), 1, 0, 1, Height - 1); + }); + + bborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_lightBack), 0, 0, Width - 1, 0); + e.Graphics.DrawLine(new Pen(textboxcolor), 0, 1, Width - 2, 1); + }); + + tborder.Invalidate(); + lborder.Invalidate(); + rborder.Invalidate(); + bborder.Invalidate(); + } + catch { } } } } diff --git a/Histacom2.Engine/UI/ClassicDropDown.resx b/Histacom2.Engine/UI/ClassicDropDown.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2.Engine/UI/ClassicDropDown.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 0f3eee8..8da51f7 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -55,6 +55,7 @@ this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); + this.classicDropDown1 = new Histacom2.Engine.UI.ClassicDropDown(); this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); @@ -283,6 +284,7 @@ // // pnlSave // + this.pnlSave.Controls.Add(this.classicDropDown1); this.pnlSave.Controls.Add(this.txtSave); this.pnlSave.Controls.Add(this.classicLabel2); this.pnlSave.Controls.Add(this.classicLabel1); @@ -295,6 +297,17 @@ this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // + // classicDropDown1 + // + this.classicDropDown1.BackColor = System.Drawing.Color.White; + this.classicDropDown1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.classicDropDown1.Location = new System.Drawing.Point(56, 31); + this.classicDropDown1.Name = "classicDropDown1"; + this.classicDropDown1.Size = new System.Drawing.Size(549, 20); + this.classicDropDown1.TabIndex = 23; + this.classicDropDown1.Text = "classicDropDown1"; + this.classicDropDown1.UseSystemPasswordChar = false; + // // txtSave // this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -309,14 +322,16 @@ // // classicLabel2 // + this.classicLabel2.DropShadow = false; this.classicLabel2.Location = new System.Drawing.Point(3, 32); this.classicLabel2.Name = "classicLabel2"; this.classicLabel2.Size = new System.Drawing.Size(64, 13); this.classicLabel2.TabIndex = 19; - this.classicLabel2.Text = "File name:"; + this.classicLabel2.Text = "File type:"; // // classicLabel1 // + this.classicLabel1.DropShadow = false; this.classicLabel1.Location = new System.Drawing.Point(3, 6); this.classicLabel1.Name = "classicLabel1"; this.classicLabel1.Size = new System.Drawing.Size(64, 13); @@ -411,5 +426,6 @@ private Engine.UI.ClassicLabel classicLabel2; private Engine.UI.ClassicLabel classicLabel1; private Engine.UI.ClassicTextBox txtSave; + private Engine.UI.ClassicDropDown classicDropDown1; } } -- cgit v1.2.3 From 2a473d05a34afe51cf0f5340cbdd48ad4e771657 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 08:51:38 +0000 Subject: ClassicDropDown + ClassicTextBox! Finally! It only took 2 months... --- Histacom2.Engine/Histacom2.Engine.csproj | 19 +++- Histacom2.Engine/Template/DropDownItem.Designer.cs | 63 +++++++++++ Histacom2.Engine/Template/DropDownItem.cs | 42 ++++++++ Histacom2.Engine/Template/DropDownItem.resx | 120 +++++++++++++++++++++ .../Template/DropDownOverlay.Designer.cs | 64 +++++++++++ Histacom2.Engine/Template/DropDownOverlay.cs | 26 +++++ Histacom2.Engine/Template/DropDownOverlay.resx | 120 +++++++++++++++++++++ Histacom2.Engine/UI/ClassicDropDown.Designer.cs | 30 +++--- Histacom2.Engine/UI/ClassicDropDown.cs | 82 +++++++++++++- Histacom2.Engine/UI/ClassicTextbox.cs | 12 ++- Histacom2.Engine/UI/OldClassicTextbox.cs | 77 ------------- .../Win95Apps/Win95WindowsExplorer.Designer.cs | 86 ++++++--------- .../OS/Win95/Win95Apps/Win95WindowsExplorer.cs | 2 + 13 files changed, 590 insertions(+), 153 deletions(-) create mode 100644 Histacom2.Engine/Template/DropDownItem.Designer.cs create mode 100644 Histacom2.Engine/Template/DropDownItem.cs create mode 100644 Histacom2.Engine/Template/DropDownItem.resx create mode 100644 Histacom2.Engine/Template/DropDownOverlay.Designer.cs create mode 100644 Histacom2.Engine/Template/DropDownOverlay.cs create mode 100644 Histacom2.Engine/Template/DropDownOverlay.resx delete mode 100644 Histacom2.Engine/UI/OldClassicTextbox.cs (limited to 'Histacom2.Engine/UI/ClassicDropDown.Designer.cs') 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 @@ + + UserControl + + + DropDownItem.cs + + + Form + + + DropDownOverlay.cs + Form @@ -112,7 +124,6 @@ ClassicTextBox.cs - Component @@ -130,6 +141,12 @@ PublicResXFileCodeGenerator Resources.Designer.cs + + DropDownItem.cs + + + DropDownOverlay.cs + ResizeOverlay.cs 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 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ 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 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ 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 items = new List { "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); - // } -} diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 8da51f7..2a96033 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -51,17 +51,15 @@ this.HelpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.AboutWindows95ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toprightcorner = new System.Windows.Forms.Panel(); - this.bottomrightcorner = new System.Windows.Forms.Panel(); - this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); - this.classicDropDown1 = new Histacom2.Engine.UI.ClassicDropDown(); + this.cmbType = new Histacom2.Engine.UI.ClassicDropDown(); this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); - this.classicButton1 = new Histacom2.Engine.UI.ClassicButton(); this.btnSave = new Histacom2.Engine.UI.ClassicButton(); this.refresh = new System.Windows.Forms.Timer(this.components); + this.btnCanc = new Histacom2.Engine.UI.ClassicButton(); this.program.SuspendLayout(); this.MenuStrip1.SuspendLayout(); this.pnlSave.SuspendLayout(); @@ -74,8 +72,6 @@ this.program.Controls.Add(this.diskView); this.program.Controls.Add(this.MenuStrip1); this.program.Controls.Add(this.toprightcorner); - this.program.Controls.Add(this.bottomrightcorner); - this.program.Controls.Add(this.bottomleftcorner); this.program.Controls.Add(this.topleftcorner); this.program.Controls.Add(this.pnlSave); this.program.Dock = System.Windows.Forms.DockStyle.Fill; @@ -258,23 +254,6 @@ this.toprightcorner.Size = new System.Drawing.Size(4, 4); this.toprightcorner.TabIndex = 6; // - // bottomrightcorner - // - this.bottomrightcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bottomrightcorner.Cursor = System.Windows.Forms.Cursors.SizeNWSE; - this.bottomrightcorner.Location = new System.Drawing.Point(700, 513); - this.bottomrightcorner.Name = "bottomrightcorner"; - this.bottomrightcorner.Size = new System.Drawing.Size(4, 4); - this.bottomrightcorner.TabIndex = 4; - // - // bottomleftcorner - // - this.bottomleftcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.bottomleftcorner.Location = new System.Drawing.Point(0, 513); - this.bottomleftcorner.Name = "bottomleftcorner"; - this.bottomleftcorner.Size = new System.Drawing.Size(4, 4); - this.bottomleftcorner.TabIndex = 2; - // // topleftcorner // this.topleftcorner.Location = new System.Drawing.Point(0, 0); @@ -284,11 +263,11 @@ // // pnlSave // - this.pnlSave.Controls.Add(this.classicDropDown1); + this.pnlSave.Controls.Add(this.btnCanc); + this.pnlSave.Controls.Add(this.cmbType); this.pnlSave.Controls.Add(this.txtSave); this.pnlSave.Controls.Add(this.classicLabel2); this.pnlSave.Controls.Add(this.classicLabel1); - this.pnlSave.Controls.Add(this.classicButton1); this.pnlSave.Controls.Add(this.btnSave); this.pnlSave.Dock = System.Windows.Forms.DockStyle.Bottom; this.pnlSave.Location = new System.Drawing.Point(0, 463); @@ -297,16 +276,15 @@ this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // - // classicDropDown1 + // cmbType // - this.classicDropDown1.BackColor = System.Drawing.Color.White; - this.classicDropDown1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); - this.classicDropDown1.Location = new System.Drawing.Point(56, 31); - this.classicDropDown1.Name = "classicDropDown1"; - this.classicDropDown1.Size = new System.Drawing.Size(549, 20); - this.classicDropDown1.TabIndex = 23; - this.classicDropDown1.Text = "classicDropDown1"; - this.classicDropDown1.UseSystemPasswordChar = false; + this.cmbType.BackColor = System.Drawing.Color.White; + this.cmbType.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.cmbType.Location = new System.Drawing.Point(56, 31); + this.cmbType.Name = "cmbType"; + this.cmbType.Size = new System.Drawing.Size(549, 20); + this.cmbType.TabIndex = 23; + this.cmbType.UseSystemPasswordChar = false; // // txtSave // @@ -316,7 +294,7 @@ this.txtSave.BackColor = System.Drawing.Color.White; this.txtSave.Location = new System.Drawing.Point(56, 6); this.txtSave.Name = "txtSave"; - this.txtSave.Size = new System.Drawing.Size(549, 17); + this.txtSave.Size = new System.Drawing.Size(549, 20); this.txtSave.TabIndex = 22; this.txtSave.UseSystemPasswordChar = false; // @@ -338,27 +316,12 @@ this.classicLabel1.TabIndex = 19; this.classicLabel1.Text = "File name:"; // - // classicButton1 - // - this.classicButton1.AdaptBackColorWithTheme = true; - this.classicButton1.AdaptFontWithTheme = true; - this.classicButton1.AdaptForeColorWithTheme = true; - this.classicButton1.BackColor = System.Drawing.Color.Silver; - this.classicButton1.DialogResult = System.Windows.Forms.DialogResult.None; - this.classicButton1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); - this.classicButton1.ForeColor = System.Drawing.Color.Black; - this.classicButton1.Location = new System.Drawing.Point(611, 29); - this.classicButton1.Name = "classicButton1"; - this.classicButton1.Size = new System.Drawing.Size(75, 23); - this.classicButton1.TabIndex = 17; - this.classicButton1.Text = "Cancel"; - this.classicButton1.Click += new System.EventHandler(this.btnSave_Click); - // // btnSave // this.btnSave.AdaptBackColorWithTheme = true; this.btnSave.AdaptFontWithTheme = true; this.btnSave.AdaptForeColorWithTheme = true; + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnSave.BackColor = System.Drawing.Color.Silver; this.btnSave.DialogResult = System.Windows.Forms.DialogResult.None; this.btnSave.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -375,6 +338,21 @@ this.refresh.Interval = 15000; this.refresh.Tick += new System.EventHandler(this.refresh_Tick); // + // btnCanc + // + this.btnCanc.AdaptBackColorWithTheme = true; + this.btnCanc.AdaptFontWithTheme = true; + this.btnCanc.AdaptForeColorWithTheme = true; + this.btnCanc.BackColor = System.Drawing.Color.Silver; + this.btnCanc.DialogResult = System.Windows.Forms.DialogResult.None; + this.btnCanc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.btnCanc.ForeColor = System.Drawing.Color.Black; + this.btnCanc.Location = new System.Drawing.Point(611, 27); + this.btnCanc.Name = "btnCanc"; + this.btnCanc.Size = new System.Drawing.Size(75, 25); + this.btnCanc.TabIndex = 24; + this.btnCanc.Text = "Cancel"; + // // Win95WindowsExplorer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -415,17 +393,15 @@ internal System.Windows.Forms.ToolStripMenuItem HelpToolStripMenuItem1; internal System.Windows.Forms.ToolStripMenuItem AboutWindows95ToolStripMenuItem; internal System.Windows.Forms.Panel toprightcorner; - internal System.Windows.Forms.Panel bottomrightcorner; - internal System.Windows.Forms.Panel bottomleftcorner; internal System.Windows.Forms.Panel topleftcorner; internal System.Windows.Forms.ListView mainView; internal System.Windows.Forms.Panel pnlSave; private System.Windows.Forms.Timer refresh; private Engine.UI.ClassicButton btnSave; - private Engine.UI.ClassicButton classicButton1; private Engine.UI.ClassicLabel classicLabel2; private Engine.UI.ClassicLabel classicLabel1; private Engine.UI.ClassicTextBox txtSave; - private Engine.UI.ClassicDropDown classicDropDown1; + private Engine.UI.ClassicDropDown cmbType; + private Engine.UI.ClassicButton btnCanc; } } diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 9038a96..f118542 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -45,6 +45,8 @@ namespace Histacom2.OS.Win95.Win95Apps ctrl.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); } + txtSave.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); + cmbType.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); //Histacom2.Engine.UI.CustomTextBox ctb = new Histacom2.Engine.UI.CustomTextBox(textBox1); } -- cgit v1.2.3