aboutsummaryrefslogtreecommitdiff
path: root/Histacom2.Engine/UI
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-09-12 09:51:26 -0400
committerlempamo <[email protected]>2017-09-12 09:51:26 -0400
commitab9f118edb06826ed49c0b46bb1bce38d407e4f6 (patch)
tree63e46f589ac10f4df5806c5d2ecb4c104adaed92 /Histacom2.Engine/UI
parentc11ba68e8f319acc62b72259235a04b12892bffa (diff)
downloadhistacom2-ab9f118edb06826ed49c0b46bb1bce38d407e4f6.tar.gz
histacom2-ab9f118edb06826ed49c0b46bb1bce38d407e4f6.tar.bz2
histacom2-ab9f118edb06826ed49c0b46bb1bce38d407e4f6.zip
various classic control things
Diffstat (limited to 'Histacom2.Engine/UI')
-rw-r--r--Histacom2.Engine/UI/ClassicButton.cs35
-rw-r--r--Histacom2.Engine/UI/ClassicLabel.cs29
2 files changed, 57 insertions, 7 deletions
diff --git a/Histacom2.Engine/UI/ClassicButton.cs b/Histacom2.Engine/UI/ClassicButton.cs
index b761504..1a77964 100644
--- a/Histacom2.Engine/UI/ClassicButton.cs
+++ b/Histacom2.Engine/UI/ClassicButton.cs
@@ -8,14 +8,26 @@ using System.Windows.Forms;
namespace Histacom2.Engine.UI
{
- public class ClassicButton : Control
+ public class ClassicButton : Control, IButtonControl
{
private Color _lightBack;
private Color _darkBack;
- private Font _font;
private bool _pressing = false;
+ public DialogResult DialogResult
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
public ClassicButton() : base()
{
if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor;
@@ -26,8 +38,8 @@ namespace Histacom2.Engine.UI
if (SaveSystem.currentTheme != null) ForeColor = SaveSystem.currentTheme.threeDObjectsTextColor;
else ForeColor = Color.Black;
- if (SaveSystem.currentTheme != null) _font = SaveSystem.currentTheme.buttonFont;
- else _font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular);
+ if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont;
+ else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular);
MouseDown += (s, e) => { _pressing = true; Invalidate(); };
MouseUp += (s, e) => { _pressing = false; Invalidate(); };
@@ -59,7 +71,7 @@ namespace Histacom2.Engine.UI
g.FillRectangle(new SolidBrush(_darkBack), new Rectangle(1, 1, Width - 2, Height - 2));
g.FillRectangle(new SolidBrush(BackColor), new Rectangle(2, 2, Width - 3, Height - 3));
- g.DrawString(Text, _font, new SolidBrush(ForeColor), ((Width / 2) + 1) + Padding.Left, (Height / 2) - (g.MeasureString(Text, Font).Height / 2) + 2, sf);
+ g.DrawString(Text, Font, new SolidBrush(ForeColor), ((Width / 2) + 1) + Padding.Left, (Height / 2) - (g.MeasureString(Text, Font).Height / 2) + 2, sf);
}
else
{
@@ -68,9 +80,18 @@ namespace Histacom2.Engine.UI
g.FillRectangle(new SolidBrush(_darkBack), new Rectangle(1, 1, Width - 2, Height - 2));
g.FillRectangle(new SolidBrush(BackColor), new Rectangle(1, 1, Width - 3, Height - 3));
- g.DrawString(Text, _font, new SolidBrush(ForeColor), (Width / 2) + Padding.Left, (Height / 2) - (g.MeasureString(Text, Font).Height / 2) + 1, sf);
+ g.DrawString(Text, Font, new SolidBrush(ForeColor), (Width / 2) + Padding.Left, (Height / 2) - (g.MeasureString(Text, Font).Height / 2) + 1, sf);
}
}
-
+
+ public void NotifyDefault(bool value)
+ {
+
+ }
+
+ public void PerformClick()
+ {
+ this.OnClick(new EventArgs());
+ }
}
}
diff --git a/Histacom2.Engine/UI/ClassicLabel.cs b/Histacom2.Engine/UI/ClassicLabel.cs
new file mode 100644
index 0000000..0b9d9c2
--- /dev/null
+++ b/Histacom2.Engine/UI/ClassicLabel.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Histacom2.Engine.UI
+{
+ public class ClassicLabel : Control
+ {
+ public ClassicLabel()
+ {
+
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+ var gfx = e.Graphics;
+ gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
+
+ gfx.DrawString(Text, Font, new SolidBrush(ForeColor), 0, 0);
+ }
+ }
+}