Exemplo n.º 1
0
 internal void Init(QQTextBox textbox, TDataGridView gridview1)
 {
     this.TextBox              = textbox;
     this.gridview1            = gridview1;
     textbox.Edit.LostFocus   += TextBox_LostFocus;
     textbox.Edit.Click       += TextBox_Click;
     textbox.KeyDown          += TextBox_KeyDown;
     gridview1.RefreshChanged += Gridview1_RefreshChanged;
     gridview1.DoubleClick    += Gridview1_DoubleClick;
     this.Location             = new Point(TextBox.Location.X + 1, TextBox.Location.Y + TextBox.Height - 2);
     this.Width = TextBox.Width - 2;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 绑定TextBox
 /// </summary>
 /// <param name="textbox">TextBox</param>
 /// <param name="list">数据源</param>
 /// <param name="obj">按指定实体名称显示</param>
 /// <param name="showCount">控件按指定数量行高度设置</param>
 /// <param name="totalCount">控件最大显示数量</param>
 public void Init(QQTextBox textbox, List <T> list, object obj = null, int showCount = 5, int totalCount = 20)
 {
     this.list       = list;
     this.totalCount = totalCount;
     this.showCount  = showCount;
     this.showType   = obj?.GetType();
     {
         textbox.Parent.Controls.Add(this);
         textbox.Parent.Controls.SetChildIndex(this, 0);
     }
     base.Init(textbox, gridview1);
     textbox.TextChanged += TextBox_TextChanged;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 绑定TextBox
        /// </summary>
        /// <param name="textbox">TextBox</param>
        /// <param name="value">枚举值</param>
        /// <param name="action">过滤方法</param>
        /// <param name="count">控件按指定数量行高度设置</param>
        public void Init <T>(QQTextBox textbox, T value, Func <T, bool> action = null, int count = 5)
        {
            this.showCount = count;
            var list = new List <MultipleInfo>();

            this.enumType = typeof(T);
            var valueInt = enumType.Parse(value);

            foreach (var field in enumType.GetFields(TConfig.Flags))
            {
                var item = (T)field.GetRawConstantValue();
                if (action?.Invoke(item) == true)
                {
                    continue;
                }
                var info = new MultipleInfo()
                {
                    Name = field.Description()
                };
                var itemInt = (int)field.GetRawConstantValue();
                if (itemInt != 0 && (itemInt & valueInt) == itemInt)
                {
                    info.Selected = true;
                }
                list.Add(info);
            }
            foreach (var item in list)
            {
                item.Image = item.Selected ? Resources.Controls_accept_16 : Resources.Controls_blank;
            }
            this.list = list;
            {
                textbox.Parent.Controls.Add(this);
                textbox.Parent.Controls.SetChildIndex(this, 0);
            }
            base.Init(textbox, gridview1);
            UpdateSelected();
            textbox.Edit.ReadOnly        = true;
            gridview1.RowTemplate.Height = 24;
            gridview1.CellClick         += Gridview1_CellClick;
        }