Example #1
0
        /// <summary>
        /// 绘制列头的文本。
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="column"></param>
        /// <param name="rect"></param>
        protected virtual void DrawColumnHeaderText(Graphics graphics, TreeListColumn column, Rectangle rect)
        {
            var foreColor = column.ForeColor.IsEmpty ? column.TreeList.ForeColor : column.ForeColor;
            var font      = column.Font ?? column.TreeList.Font;

            var flags = TextFormatFlags.EndEllipsis | TextFormatFlags.VerticalCenter;

            if (column.TreeList.ColumnHorizontalCenter || column.TextAlign == HorizontalAlignment.Center)
            {
                flags |= TextFormatFlags.HorizontalCenter;
            }
            else if (column.TextAlign == HorizontalAlignment.Right)
            {
                flags |= TextFormatFlags.Right;
            }

            TextRenderer.DrawText(graphics, column.Text, font, rect, foreColor, flags);
        }
Example #2
0
        private void ProcessSpringColumnWidth()
        {
            var            width        = 0;
            TreeListColumn springColumn = null;
            var            assert       = new AssertFlag();

            foreach (var column in Columns)
            {
                if (!column.Spring || !assert.AssertTrue())
                {
                    width += column.Width;
                }
                else
                {
                    springColumn = column;
                }
            }

            if (springColumn != null)
            {
                springColumn.Width = Math.Max(0, Width - width - _bound.WorkBound.X * 2 - (ShowVerScrollBar ? _vbar.Width : 0));
            }
        }
Example #3
0
        /// <summary>
        /// 对集合进行排序。
        /// </summary>
        /// <param name="sortVersion"></param>
        /// <param name="column"></param>
        /// <param name="order"></param>
        internal void Sort(int sortVersion, TreeListColumn column, SortOrder order)
        {
            if (_sortVersion == sortVersion)
            {
                return;
            }

            _sortVersion = sortVersion;

            ((List <TreeListItem>)Items).Sort(new TreeListItemComparer(column, order));

            //子节点排序,重新编排索引值
            var index = 0;

            foreach (var item in Items)
            {
                if (item.Expended)
                {
                    item.Items.Sort(sortVersion, column, order);
                }

                item.Index = index++;
            }
        }
Example #4
0
 /// <summary>
 /// 对集合进行排序。
 /// </summary>
 /// <param name="column"></param>
 /// <param name="order"></param>
 public void Sort(TreeListColumn column, SortOrder order)
 {
     Sort(_sortVersion, column, order);
 }
Example #5
0
 internal TreeListColumnRenderEventArgs(TreeListColumn column, Graphics graphics, Rectangle rect)
     : base(graphics, rect)
 {
     Column = column;
 }
Example #6
0
 /// <summary>
 /// 初始化 <see cref="TreeListItemComparer"/> 类的新实例。
 /// </summary>
 /// <param name="column">当前排序的列。</param>
 /// <param name="order">排序方式。</param>
 public TreeListItemComparer(TreeListColumn column, SortOrder order)
 {
     _column = column;
     _order  = order;
 }
 /// <summary>
 /// 初始化 <see cref="TreeListItemComparer"/> 类的新实例。
 /// </summary>
 /// <param name="column">当前排序的列。</param>
 /// <param name="order">排序方式。</param>
 public TreeListItemComparer(TreeListColumn column, SortOrder order)
 {
     this.column = column;
     this.order  = order;
 }