aboutsummaryrefslogtreecommitdiff
path: root/Histacom2.Engine/UI/ClassicTextbox.cs
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-11-05 09:25:55 -0500
committerGitHub <[email protected]>2017-11-05 09:25:55 -0500
commitf0e2d14a959db1e5d35c4dc5f77ed3523c93200a (patch)
tree7ae4244e5f5c3dc38f4b228f15efe4ea5be0fe3a /Histacom2.Engine/UI/ClassicTextbox.cs
parent458cc4ee0dbc67f547ea851b5a67a88af119a4c0 (diff)
parent55bc23bd3797debcfc461ef23df344d16212f235 (diff)
downloadhistacom2-f0e2d14a959db1e5d35c4dc5f77ed3523c93200a.tar.gz
histacom2-f0e2d14a959db1e5d35c4dc5f77ed3523c93200a.tar.bz2
histacom2-f0e2d14a959db1e5d35c4dc5f77ed3523c93200a.zip
Merge pull request #180 from Alex-TIMEHACK/master
ClassicTextBox and ClassicDropDown
Diffstat (limited to 'Histacom2.Engine/UI/ClassicTextbox.cs')
-rw-r--r--Histacom2.Engine/UI/ClassicTextbox.cs112
1 files changed, 84 insertions, 28 deletions
diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs
index e38af16..4847ed5 100644
--- a/Histacom2.Engine/UI/ClassicTextbox.cs
+++ b/Histacom2.Engine/UI/ClassicTextbox.cs
@@ -1,6 +1,8 @@
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;
@@ -8,47 +10,101 @@ using System.Windows.Forms;
namespace Histacom2.Engine.UI
{
- public class ClassicTextbox : Control
+ public partial class ClassicTextBox : UserControl
{
- public bool UseSystemPasswordChar { get; set; }
+ public static Color textboxcolor = Color.Black;
- public ClassicTextbox() : base()
+ public static Color _lightBack = Color.Silver;
+ public static Color _darkBack = Color.Silver;
+
+ public override string Text
{
- if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont;
- else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular);
+ get
+ {
+ return textBox1.Text;
+ }
+ set
+ {
+ textBox1.Text = value;
+ }
}
- protected override void OnPaint(PaintEventArgs e)
+ public bool UseSystemPasswordChar
{
- base.OnPaint(e);
+ get
+ {
+ return textBox1.UseSystemPasswordChar;
+ }
+ set
+ {
+ textBox1.UseSystemPasswordChar = value;
+ }
+ }
+
+ public ClassicTextBox()
+ {
+ 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;
+ BackColor = SaveSystem.currentTheme.threeDObjectsColor;
+ }
+ else
+ {
+ textBox1.BackColor = Color.White;
+ BackColor = Color.White;
+ }
+
+ if (SaveSystem.currentTheme != null)
+ {
+ textboxcolor = SaveSystem.currentTheme.windowColor;
+
+ _lightBack = Paintbrush.GetLightFromColor(textboxcolor);
+ _darkBack = Paintbrush.GetDarkFromColor(textboxcolor);
+ }
+ });
- var textboxcolor = Color.Silver;
- if (SaveSystem.currentTheme != null) textboxcolor = SaveSystem.currentTheme.windowColor;
- if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor;
- else BackColor = Color.White;
+ 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);
- 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);
+ 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);
+ });
- var g = e.Graphics;
- g.Clear(BackColor);
+ 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);
+ });
- 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);
+ 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);
+ });
- 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);
+ tborder.Invalidate();
+ lborder.Invalidate();
+ rborder.Invalidate();
+ bborder.Invalidate();
+ } catch { }
}
}
}