/****************************** * 说明:自定义图片控件(数据库存放image类型) * 创建人:龚宇超 * 创建日期:2017-08-07 * 修改人: * 修改日期: * 修改备注: * 版本:1.0.0.0 ******************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; namespace Lskj.Control { /// /// 自定义图片控件(数据库存放image类型) /// [Obsolete("此方式展示图片已过期,请使用LabelImageEdit控件")] public partial class LabelPictureEdit : BaseUserControl { /// /// 是否初始设置 /// public bool IsInitSetting = true; /// /// 初始数据 /// public Image SourceImage = null; /// /// 图片控件 /// public PictureEdit TextEdit { get { return txtEdit; } } public LabelPictureEdit() { InitializeComponent(); } /// /// 说明:设置控件显示文本 /// 创建人:龚宇超 /// 创建日期:2017-08-07 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// 显示Lebel文本 public override string LabelText { get { return this.lblText.Text; } set { this.lblText.Text = value; if (FontSize > 0) { this.plLeft.Dock = DockStyle.Left; this.plLeft.AutoSize = false; this.lblText.AutoSize = false; this.lblText.Dock = System.Windows.Forms.DockStyle.Fill; this.lblText.Location = new System.Drawing.Point(0, 0); this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.txtEdit.Properties.AutoHeight = false; this.plLeft.Width = value.Length * GetCharWidth(); GetCharWidthMultilingual(this.lblText, this.lblText.Text, this.plLeft); } else { this.plLeft.Width = this.lblText.Width + PaddingLeft; } } } /// /// 字体大小 /// /// The size of the control. public override float FontSize { get { return base.FontSize; } set { base.FontSize = value; if (value > 0) { this.lblText.Font = new Font(this.lblText.Font.FontFamily, value); this.TextEdit.Font = new Font(this.TextEdit.Font.FontFamily, value); } } } /// /// 说明:设置控件值 /// 创建人:龚宇超 /// 创建日期:2017-08-07 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// public override string EditText { get { return this.txtEdit.Text; } set { this.txtEdit.Text = value; } } /// /// 说明:是否为空 /// 创建人:龚宇超 /// 创建日期:2017-11-06 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// true if this instance is empty; otherwise, false. /// The is empty. public override bool IsEmpty() { return base.Model != null && base.Model.IsEmpty && this.TextEdit.Image != null; } /// /// 只读文本颜色 /// /// The color of the read only label. public override bool ReadOnly { get { return base.ReadOnly; } set { base.ReadOnly = value; this.txtEdit.Properties.ReadOnly = value; this.lblText.ForeColor = value ? base.ReadOnlyLabelForceColor : Required ? base.RequiredLabelForceColor : base.DefaultLabelForceColor; } } /// /// 必填文本颜色 /// /// The color of the required label. public override bool Required { get { return base.Required; } set { base.Required = value; if (value) { this.lblText.ForeColor = base.RequiredLabelForceColor; } } } /// /// 说明:图片是否修改,暂未实现 /// 创建人:龚宇超 /// 创建日期:2017-11-08 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// true if this instance is update; otherwise, false. public override bool IsUpdate() { return this.SourceImage != this.txtEdit.Image; } } }