using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace DPumpHydr.WinFrmUI.WenSkin.Forms
|
{
|
public class WenBottomInfoForm : WenForm
|
{
|
public WenBottomInfoForm() : base()
|
{
|
this.Name = "WenBottomInfoForm";
|
this.Text = "WenBottomInfoForm";
|
RefreshPadding();
|
}
|
private int bottomWidth = 30;
|
private string bottomText;
|
|
[Category("Wen")]
|
[Description("底部信息栏大小")]
|
[RefreshProperties(RefreshProperties.All)]
|
public int BottomWidth
|
{
|
get => bottomWidth;
|
set
|
{
|
bottomWidth = value;
|
RefreshPadding();
|
}
|
}
|
[Category("Wen")]
|
[Description("底部信息栏显示内容")]
|
[RefreshProperties(RefreshProperties.All)]
|
public string BottomText
|
{
|
get => bottomText;
|
set
|
{
|
bottomText = value;
|
RefreshPadding();
|
}
|
}
|
|
[DefaultValue(typeof(Padding), "30,0,0,30"), Category("布局"), Description("指定控件内部间距")]
|
public new Padding Padding { get => base.Padding; set => base.Padding = value; }
|
|
protected override void RefreshPadding()
|
{
|
//this.Padding = new Padding() { Top = TitleHeight, Left = FrameWidth, Bottom = bottomWidth, Right = FrameWidth };
|
//this.Invalidate();
|
this.Padding = new Padding() { Top = TitleHeight, Left = FrameWidth, Bottom = bottomWidth, Right = FrameWidth };
|
this.Invalidate();
|
}
|
|
protected override void OnPaint(PaintEventArgs e)
|
{
|
base.OnPaint(e);
|
Graphics g = e.Graphics;
|
DrawBottomInfo(g);
|
}
|
|
|
private void DrawBottomInfo(Graphics g)
|
{
|
Brush b = new SolidBrush(FrameColor);
|
g.FillRectangle(b, 0, this.Height - BottomWidth, this.Width, BottomWidth);
|
|
//绘制底部信息
|
_ = TextRenderer.MeasureText(bottomText, this.Font).Width;
|
|
Rectangle rec = new Rectangle(0, this.Height - BottomWidth, this.Width, BottomWidth);
|
Rectangle recStr = new Rectangle(10, rec.Y, rec.Width - 20, rec.Height);
|
|
g.DrawString(bottomText, this.Font, new SolidBrush(this.ForeColor), recStr,
|
new StringFormat(StringFormatFlags.NoClip | StringFormatFlags.NoWrap)
|
{
|
LineAlignment = StringAlignment.Center,
|
Alignment = StringAlignment.Far,
|
Trimming = StringTrimming.EllipsisCharacter
|
});
|
}
|
|
}
|
}
|