Files
Inspection/JinYuan.ControlLib/LongTitle.cs
T
2026-09-09 19:21:21 +08:00

75 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JinYuan.ControlLib
{
public partial class LongTitle : UserControl
{
public LongTitle()
{
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);
}
private bool isRight = true;
[Browsable(true)]//是否可见
[Category("自定义属性")] //类别
[Description("设置或显示导航按钮是否为右边")]
public bool IsRight
{
get { return isRight; }
set
{
isRight = value;
UpdataImage();
}
}
private string titleName = "标题名称";
[Browsable(true)]//是否可见
[Category("自定义属性")] //类别
[Description("设置或显示标题名称")]
public string TitleName
{
get { return titleName; }
set
{
titleName = value;
this.lbl_Title.Text = titleName;
}
}
/// <summary>
///统一更新背景
/// </summary>
private void UpdataImage()
{
if (this.isRight)
{
lbl_Title.Dock = DockStyle.Right;
this.BackgroundImage = Properties.Resources.标题_03右;
}
else
{
lbl_Title.Dock = DockStyle.Left;
this.BackgroundImage =Properties.Resources.标题_03左;
}
}
}
}