123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- 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 System.Runtime.InteropServices;
- namespace LYFZ.ComponentLibrary
- {
- public partial class TextBoxEx : OtherExpansion.SkinControl.SkinTextBox
- {
- #region 声明
- private bool _Isico = false;
- private Bitmap _Ico;
- private Padding _IcoPadding = new Padding(3, 3, 0, 0);
- #endregion
- public TextBoxEx()
- : base()
- {
- this.BaseText.TextChanged += BaseText_TextChanged;
- }
- #region 属性
-
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- [Category("控件扩展属性"), Description("将控件设为密码显示")]
- public bool IsPass
- {
- get
- {
- return this.IsSystemPasswordChar;
- }
- set
- {
- this.IsSystemPasswordChar = value;
-
-
- }
- }
- [Category("控件扩展属性"), Description("密码显示字符")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public char PassChar
- {
- get
- {
- return this.IsPasswordChat;
- }
- set
- {
- this.IsPasswordChat = value;
- Invalidate(false);
- }
- }
- Font _Font = new Font("宋体", 10.5f);
-
- [Category("控件扩展属性"), Description("此属性过期不建议使用 设置控件中文本字体")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public Font NewFont
- {
- get
- {
- return _Font;
- }
- set
- {
- _Font = value;
- }
- }
-
- [Category("控件扩展属性"), Description("此属性过期不建议使用 多行文本的编辑行")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public String[] lines
- {
- get
- {
- return this.Lines;
- }
- set
- {
- this.Lines = value;
- Invalidate(false);
- }
- }
-
- [Category("控件扩展属性"), Description("此属性过期不建议使用 是否显示图标")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public bool Isico
- {
- get
- {
- return _Isico;
- }
- set
- {
- _Isico = value;
-
- }
- }
-
- [Category("控件扩展属性"), Description("此属性过期不建议使用 图标文件")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public Bitmap Ico
- {
- get
- {
- return _Ico;
- }
- set
- {
- _Ico = value;
- }
- }
-
- [Category("控件扩展属性"), Description("此属性过期不建议使用 控件内部间距,图标文件")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public Padding IcoPadding
- {
- get { return _IcoPadding; }
- set
- {
- _IcoPadding = value;
-
- }
- }
- #region 文本框边框颜色
- [DllImport("user32.dll")]
- private static extern IntPtr GetWindowDC(IntPtr hwnd);
- [DllImport("user32.dll")]
- private static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
- private Color _borderColor = Color.Black;
- private int _borderWidth = 1;
-
-
-
-
-
-
-
-
- [Description("组件的边框颜色。"), Category("此属性过期不建议使用 Appearance")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public Color BorderColor
- {
- get
- {
- return _borderColor;
- }
- set
- {
- _borderColor = value;
- this.Invalidate();
- }
- }
-
-
-
-
-
-
-
-
- [Description("组件的边框宽度。"), Category("此属性过期不建议使用 Appearance")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public int BorderWidth
- {
- get
- {
- return _borderWidth;
- }
- set
- {
- _borderWidth = value;
-
- }
- }
- #endregion
- #endregion
- #region 方法
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public delegate void TextBoxEx_TextChanged(object sender, EventArgs e);
-
-
-
- [Category("控件扩展事件"), Description("文本框值修改时")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
- public event TextBoxEx_TextChanged EventTextBoxEx_TextChanged;
-
-
-
-
-
- private void BaseText_TextChanged(object sender, EventArgs e)
- {
- if (this.EventTextBoxEx_TextChanged != null)
- EventTextBoxEx_TextChanged(sender, e);
- }
- #endregion
- }
- }
|