|
|
@@ -1,4 +1,4 @@
|
|
|
-using BluePointLilac.Methods;
|
|
|
+using BluePointLilac.Methods;
|
|
|
using System;
|
|
|
using System.Drawing;
|
|
|
using System.Windows.Forms;
|
|
|
@@ -19,32 +19,10 @@ namespace BluePointLilac.Controls
|
|
|
this.ForeColor = Color.White;
|
|
|
}
|
|
|
|
|
|
- public new string Text
|
|
|
+ public override string Text
|
|
|
{
|
|
|
get => base.Text;
|
|
|
- set
|
|
|
- {
|
|
|
- if(base.Text == value) return;
|
|
|
- base.Text = value; Refresh();
|
|
|
- }
|
|
|
- }
|
|
|
- public new Font Font
|
|
|
- {
|
|
|
- get => base.Font;
|
|
|
- set
|
|
|
- {
|
|
|
- if(base.Font == value) return;
|
|
|
- base.Font = value; Refresh();
|
|
|
- }
|
|
|
- }
|
|
|
- public new Color ForeColor
|
|
|
- {
|
|
|
- get => base.ForeColor;
|
|
|
- set
|
|
|
- {
|
|
|
- if(base.ForeColor == value) return;
|
|
|
- base.ForeColor = value; Refresh();
|
|
|
- }
|
|
|
+ set => base.Text = value;
|
|
|
}
|
|
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
@@ -52,24 +30,42 @@ namespace BluePointLilac.Controls
|
|
|
base.OnPaint(e);
|
|
|
string txt = this.Text;
|
|
|
int left = this.Height / 3;
|
|
|
- for(int i = Text.Length - 1; i >= 0; i--)
|
|
|
+ for(int i = this.Text.Length - 1; i >= 0; i--)
|
|
|
{
|
|
|
- Size size = TextRenderer.MeasureText(txt, Font);
|
|
|
+ Size size = TextRenderer.MeasureText(txt, this.Font);
|
|
|
if(size.Width < ClientSize.Width - 2 * left)
|
|
|
{
|
|
|
- int top = (this.Height - size.Height) / 2;
|
|
|
- e.Graphics.Clear(BackColor);
|
|
|
- e.Graphics.DrawString(txt, Font, new SolidBrush(ForeColor), left, top);
|
|
|
- break;
|
|
|
+ using(Brush brush = new SolidBrush(this.ForeColor))
|
|
|
+ {
|
|
|
+ int top = (this.Height - size.Height) / 2;
|
|
|
+ e.Graphics.Clear(this.BackColor);
|
|
|
+ e.Graphics.DrawString(txt, this.Font, brush, left, top);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- txt = Text.Substring(0, i) + "...";
|
|
|
+ txt = this.Text.Substring(0, i) + "...";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected override void OnResize(EventArgs e)
|
|
|
{
|
|
|
- base.OnResize(e);
|
|
|
- this.Refresh();
|
|
|
+ base.OnResize(e); this.Refresh();
|
|
|
+ }
|
|
|
+ protected override void OnTextChanged(EventArgs e)
|
|
|
+ {
|
|
|
+ base.OnTextChanged(e); this.Refresh();
|
|
|
+ }
|
|
|
+ protected override void OnFontChanged(EventArgs e)
|
|
|
+ {
|
|
|
+ base.OnFontChanged(e); this.Refresh();
|
|
|
+ }
|
|
|
+ protected override void OnForeColorChanged(EventArgs e)
|
|
|
+ {
|
|
|
+ base.OnForeColorChanged(e); this.Refresh();
|
|
|
+ }
|
|
|
+ protected override void OnBackColorChanged(EventArgs e)
|
|
|
+ {
|
|
|
+ base.OnBackColorChanged(e); this.Refresh();
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|