random-file-runner/RyzStudio/Windows/ThemedForms/TMemoBox.cs

60 lines
2.2 KiB
C#
Raw Permalink Normal View History

2021-10-24 15:49:48 +00:00
namespace RyzStudio.Windows.ThemedForms
{
using RyzStudio.Drawing;
2021-10-30 22:44:44 +00:00
using RyzStudio.Windows.Forms;
2021-10-24 15:49:48 +00:00
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public partial class TMemoBox : RyzStudio.Windows.ThemedForms.TUserControl
{
protected readonly Padding textboxPadding = new Padding(6, 6, 0, 6);
public TMemoBox() : base()
{
InitializeComponent();
this.Margin = new Padding(10, 6, 10, 6);
}
//protected override void OnResize(EventArgs e)
//{
// base.OnResize(e);
// int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
// this.Height = textBox1.Height + (b + textboxPadding.Top) + ((b - 1) + textboxPadding.Bottom);
//}
protected override void OnGotFocus(EventArgs e)
{
base.OnGotFocus(e);
textBox1.Focus();
}
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")]
public System.Windows.Forms.TextBox InnerTextBox { get => textBox1; set => textBox1 = value; }
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")]
2021-10-30 22:44:44 +00:00
public new string Text { get => ThreadControl.GetText(textBox1); set => ThreadControl.SetText(textBox1, value); }
2021-10-24 15:49:48 +00:00
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } }
protected override void updateBackground(Graphics g, ThemeStyle style)
{
int b = (styleActive.BorderWidth + 1) + styleActive.BorderPadding;
this.Padding = new Padding((b + textboxPadding.Left), (b + textboxPadding.Top), ((b - 1) + textboxPadding.Right), ((b - 1) + textboxPadding.Bottom));
Rectangoid area = new Rectangoid(this.ClientRectangle, style.BorderRadius, style.BorderWidth);
g.FillPath(new SolidBrush(style.BackColour), area.ToGraphicsPath());
g.DrawPath(new Pen(new SolidBrush(style.BorderColour), style.BorderWidth), area.ToGraphicsPath());
}
}
}