Esempio n. 1
0
 protected virtual void PaintCell(Graphics dc, Rectangle cellRect, TLNode node, TreeListColumn column)
 {
     if (this.DesignMode)
     {
         CellPainter.PaintCell(dc, cellRect, node, column, GetFormatting(node, column), GetDataDesignMode(node, column));
     }
     else
     {
         CellPainter.PaintCell(dc, cellRect, node, column, GetFormatting(node, column), GetData(node, column));
     }
 }
Esempio n. 2
0
        public TreeListView()
        {
            this.DoubleBuffered = true;
            this.BackColor      = SystemColors.Window;
            this.TabStop        = true;

            m_rowPainter  = new RowPainter();
            m_cellPainter = new CellPainter(this);

            m_nodes       = new TreeListViewNodes(this);
            m_columns     = new TreeListColumnCollection(this);
            m_rowSetting  = new TreeList.RowSetting(this);
            m_viewSetting = new TreeList.ViewSetting(this);
            AddScroolBars();
        }
Esempio n. 3
0
        protected virtual void PaintNode(Graphics dc, Rectangle rowRect, TLNode node, TreeListColumn[] visibleColumns, int visibleRowIndex)
        {
            CellPainter.DrawSelectionBackground(dc, rowRect, node);
            foreach (TreeListColumn col in visibleColumns)
            {
                if (col.CalculatedRect.Right - HScrollValue() < RowHeaderWidth())
                {
                    continue;
                }

                Rectangle cellRect = rowRect;
                cellRect.X     = col.CalculatedRect.X - HScrollValue();
                cellRect.Width = col.CalculatedRect.Width;

                if (col.VisibleIndex == 0)
                {
                    int lineindet = 10;
                    // add left margin
                    cellRect.X     += Columns.Options.LeftMargin;
                    cellRect.Width -= Columns.Options.LeftMargin;

                    // add indent size
                    int indentSize = GetIndentSize(node) + 5;
                    cellRect.X     += indentSize;
                    cellRect.Width -= indentSize;
                    if (ViewOptions.ShowLine)
                    {
                        PaintLines(dc, cellRect, node);
                    }
                    cellRect.X     += lineindet;
                    cellRect.Width -= lineindet;

                    Rectangle glyphRect = GetPlusMinusRectangle(node, col, visibleRowIndex);
                    if (glyphRect != Rectangle.Empty && ViewOptions.ShowPlusMinus)
                    {
                        CellPainter.PaintCellPlusMinus(dc, glyphRect, node);
                    }

                    if (!ViewOptions.ShowLine && !ViewOptions.ShowPlusMinus)
                    {
                        cellRect.X     -= (lineindet + 5);
                        cellRect.Width += (lineindet + 5);
                    }

                    Image icon = GetNodeBitmap(node);
                    if (icon != null)
                    {
                        // center the image vertically
                        glyphRect.Y      = cellRect.Y + (cellRect.Height / 2) - (icon.Height / 2);
                        glyphRect.X      = cellRect.X;
                        glyphRect.Width  = icon.Width;
                        glyphRect.Height = icon.Height;


                        PaintImage(dc, glyphRect, node, icon);
                        cellRect.X     += (glyphRect.Width + 2);
                        cellRect.Width -= (glyphRect.Width + 2);
                    }
                    PaintCell(dc, cellRect, node, col);
                }
                else
                {
                    PaintCell(dc, cellRect, node, col);
                }
            }
        }