Example #1
0
        public override void CalcColumnInfo(ColumnInfo ci, ref int left, bool customization)
        {
            int offset = 0;

            base.CalcColumnInfo(ci, ref offset, customization);
            if (ci.Type == ColumnInfo.ColumnInfoType.Column)
            {
                MyTreeListBand ParentBand = TreeList.Bands.GetColumnParentBand(ci.Column);
                if (ParentBand == null)
                {
                    ci.Bounds = Rectangle.Empty;
                    return;
                }
                MyTreeListBandInfo bi = new MyTreeListBandInfo(ParentBand);
                bi.CalcBandInfo(this);
                int VisiblePosition = ParentBand.GetColumnIndex(ci.Column);
                if (ParentBand.BandColumn == ci.Column)
                {
                    ci.Bounds      = bi.Bounds;
                    ci.CaptionRect = new Rectangle(left + 4, 0, bi.Bounds.Width, bi.Bounds.Height);
                    if (BandLinks.ContainsKey(ci.Column))
                    {
                        BandLinks[ci.Column] = bi;
                    }
                    else
                    {
                        BandLinks.Add(ci.Column, bi);
                    }
                }
                else
                {
                    int X = bi.Bounds.X;
                    for (int i = 0; i < VisiblePosition; i++)
                    {
                        TreeListColumn Col = ParentBand.GetColumn(i);
                        if ((Col != null) && Col.Visible)
                        {
                            X += Col.Width;
                        }
                    }
                    int Y      = bi.Bounds.Bottom - 1;
                    int Width  = ci.Column.Width;
                    int Height = BandHeight * (BandMaxLevel - ParentBand.Level);
                    ci.Bounds      = new Rectangle(X, Y, Width, Height);
                    ci.CaptionRect = new Rectangle(left + 4, 0, Width, Height);
                    ColCount++;
                    left += Width;
                }
            }
            else
            {
                left += offset;
            }
            UpdateGlyphInfo(ci);
            ObjectPainter.CalcObjectBounds(GInfo.Graphics, TreeList.ElementsLookAndFeel.Painter.Header, ci);
        }
 protected override void CalcButtonRectsCore(EditorButtonObjectCollection collection)
 {
     for (int n = collection.Count - 1; n >= 0; n--)
     {
         EditorButtonObjectInfoArgs info = collection[n];
         ObjectPainter painter           = ViewInfo.GetButtonPainter(info);
         Rectangle     buttonRect        = painter.CalcObjectMinBounds(info);
         buttonRect.Width += 10;
         buttonRect        = new Rectangle(this.ClientRect.X, this.ClientRect.Y, buttonRect.Width, this.ClientRect.Height);
         Rectangle realButtonRect = buttonRect;
         info.Bounds = realButtonRect;
         painter.CalcObjectBounds(info);
         this.ClientRect.Width -= buttonRect.Width;
         if (this.IsLeft)
         {
             this.ClientRect.X += buttonRect.Width;
         }
     }
 }