Exemplo n.º 1
0
        public virtual void PaintCell(Graphics dc,
                                      Rectangle cellRect,
                                      TLNode node,
                                      TreeListColumn column,
                                      TreeList.TextFormatting format,
                                      object data)
        {
            if (format.BackColor != Color.Transparent)
            {
                Rectangle r = cellRect;
                r.X     = column.CalculatedRect.X;
                r.Width = column.CalculatedRect.Width;
                using (SolidBrush brush = new SolidBrush(format.BackColor))
                    dc.FillRectangle(brush, r);
            }
            if (data != null)
            {
                cellRect = ColumnHeaderPainter.AdjustRectangle(cellRect, format.Padding);
                //dc.DrawRectangle(Pens.Black, cellRect);

                Color color = format.ForeColor;
                if (m_owner.FocusedNode == node && Application.RenderWithVisualStyles == false)
                {
                    color = SystemColors.HighlightText;
                }
                TextFormatFlags flags = TextFormatFlags.EndEllipsis | TextFormatFlags.NoPrefix | format.GetFormattingFlags();
                TextRenderer.DrawText(dc, data.ToString(), m_owner.Font, cellRect, color, flags);
            }
        }
Exemplo n.º 2
0
 public TextFormatting(TextFormatting aCopy)
 {
     m_alignment = aCopy.m_alignment;
     m_foreColor = aCopy.m_foreColor;
     m_backColor = aCopy.m_backColor;
     m_padding   = aCopy.m_padding;
 }
Exemplo n.º 3
0
        public virtual void DrawHeader(Graphics dc, Rectangle cellRect, TreeListColumn column, TreeList.TextFormatting format, bool isHot)
        {
            if (!Application.RenderWithVisualStyles)
            {
                if (cellRect.Width > 0 && cellRect.Height > 0)
                {
                    ControlPaint.DrawButton(dc, cellRect, ButtonState.Flat);
                }
                return;
            }
            VisualStyleElement element = VisualStyleElement.Header.Item.Normal;

            if (isHot)
            {
                element = VisualStyleElement.Header.Item.Hot;
            }
            if (VisualStyleRenderer.IsElementDefined(element))
            {
                VisualStyleRenderer renderer = new VisualStyleRenderer(element);
                renderer.DrawBackground(dc, cellRect);

                if (format.BackColor != Color.Transparent)
                {
                    using (SolidBrush brush = new SolidBrush(format.BackColor))
                        dc.FillRectangle(brush, cellRect);
                }
                cellRect = AdjustRectangle(cellRect, format.Padding);
                //dc.DrawRectangle(Pens.Black, cellRect);

                Color           color = format.ForeColor;
                TextFormatFlags flags = TextFormatFlags.EndEllipsis | format.GetFormattingFlags();
                TextRenderer.DrawText(dc, column.Caption, column.Font, cellRect, color, flags);
            }
        }
Exemplo n.º 4
0
 public ConditionalFormatting(Func <TLNode, bool> condition, TextFormatting formatting)
 {
     this.condition  = condition;
     this.formatting = formatting;
 }