Ejemplo n.º 1
0
            public _Window(PopupList p)
            {
                _p = p;

                this.SuspendLayout();
                this.AutoScaleMode   = AutoScaleMode.None;
                this.StartPosition   = FormStartPosition.Manual;
                this.FormBorderStyle = FormBorderStyle.None;
                this.Text            = "Au.PopupList";
                this.ResumeLayout();
            }
Ejemplo n.º 2
0
            public _Control(PopupList p)
            {
                _p = p;

                this.BorderStyle = BorderStyle.FixedSingle;
                this.SetStyle(ControlStyles.Selectable                 //prevent focusing control and activating window on click
                              , false);

                this.ShowNodeToolTips = true;
                this.FullRowSelect    = true;
                this.ShowPlusMinus    = false; this.ShowLines = false;
                this.GridLineStyle    = GridLineStyle.Horizontal;
                //this.AutoRowHeight=false;

                _ccCheck                      = new NodeCheckBox();
                _ccCheck.LeftMargin           = 4;
                _ccCheck.IsVisibleValueNeeded = o => o.Tag is IPopupListItem e && e.CheckType != default;
                _ccCheck.ValueNeeded          = o => o.Tag is IPopupListItem e && e.Checked ? CheckState.Checked : default;
                NodeControls.Add(_ccCheck);

                _ccIcon                      = new NodeIcon();
                _ccIcon.LeftMargin           = 4;
                _ccIcon.ScaleMode            = ImageScaleMode.ScaleUp;
                _ccIcon.DpiStretch           = true;
                _ccIcon.IsVisibleValueNeeded = o => o.Tag is IPopupListItem e && e.Icon != null;
                _ccIcon.ValueNeeded          = o => o.Tag is IPopupListItem e ? e.Icon : null;
                NodeControls.Add(_ccIcon);

                _ccText = new NodeTextBox();
                //_ccText.LeftMargin = 0; //default 1
                _ccText.Trimming          = StringTrimming.EllipsisCharacter;
                _ccText.ValueNeeded       = node => node.Tag;
                _ccText.FontNeeded        = node => (node.Tag is IPopupListItem x && x.BoldFont) ? _p._w.FontBold : _p._w.Font;
                _ccText.DrawText         += _ccText_DrawText;
                _ccText.NeedDrawTextEvent = node => node.Tag is IPopupListItem x && (x.TextColor != default || (x.Disabled && x.BackColor == default));
                NodeControls.Add(_ccText);

#if false //test column header and multiple columns
                UseColumns = true;
                var _columnName = new TreeColumn("Name", 50);
                this.Columns.Add(_columnName);
                _ccText.ParentColumn = _columnName;

                //var _cc2 = new NodeTextBox();
                //_cc2.ValueNeeded = node => "2";
                //NodeControls.Add(_cc2);
                //var _col2 = new TreeColumn("Two", 50);
                //this.Columns.Add(_col2);
                //_cc2.ParentColumn = _col2;
#endif
            }