Files
1257B_DB/JinYuan.ControlLib/WithBgBox.cs
T

55 lines
1.5 KiB
C#
Raw Normal View History

2026-08-06 09:23:30 +08:00
using System.ComponentModel;
using System.Windows.Forms;
namespace JinYuan.ControlLib
{
public partial class WithBgBox : UserControl
{
public WithBgBox()
{
InitializeComponent();
//设置控件样式,去除缓冲
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.Selectable, true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
}
#region 减少闪烁
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000;
return cp;
}
}
#endregion
private string titleName = "标题名称";
[Browsable(true)]//是否可见
[Category("自定义属性")] //类别
[Description("设置或显示标题名称")]
public string TitleName
{
get { return titleName; }
set
{
titleName = value;
this.lbl_Title.Text = titleName;
}
}
//private void WithBgBox_Resize(object sender, EventArgs e)
//{
// lbl_Title.Left = (ClientSize.Width - lbl_Title.Width) / 2;
// lbl_Title.Top = (ClientSize.Height - lbl_Title.Height) / 2;
//}
}
}