Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="cellRect"></param>
        /// <param name="node"></param>
        /// <param name="column"></param>
        /// <param name="format"></param>
        /// <param name="data"></param>
        public virtual void PaintCell(Graphics dc,
                                      Rectangle cellRect,
                                      TreeListNode node,
                                      TreeListColumn column,
                                      TextFormatting format,
                                      object data)
        {
            if (format.BackColor != Color.Transparent)
            {
                Rectangle r = cellRect;
                r.X     = column.CalculatedRect.X;
                r.Width = column.CalculatedRect.Width;
                SolidBrush brush = new SolidBrush(format.BackColor);
                dc.FillRectangle(brush, r);
                brush.Dispose();
            }
            if (data != null)
            {
                cellRect = new Rectangle(cellRect.X + format.Padding.Left, cellRect.Y + format.Padding.Top, cellRect.Width - format.Padding.Left - format.Padding.Right, cellRect.Height - format.Padding.Top - format.Padding.Bottom);
                //dc.DrawRectangle(Pens.Black, cellRect);

                Color color = format.ForeColor;
                if (Owner.FocusedNode == node && Application.RenderWithVisualStyles == false)
                {
                    color = SystemColors.HighlightText;
                }
                TextFormatFlags flags = TextFormatFlags.EndEllipsis | format.GetFormattingFlags();
                TextRenderer.DrawText(dc, data.ToString(), Owner.Font, cellRect, color, flags);
            }
        }
Ejemplo 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;
 }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="cellRect"></param>
        /// <param name="column"></param>
        /// <param name="format"></param>
        /// <param name="isHot"></param>
        public virtual void DrawHeader(Graphics dc, Rectangle cellRect, TreeListColumn column, TextFormatting format, bool isHot)
        {
            if (!Application.RenderWithVisualStyles)
            {
                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)
                {
                    SolidBrush brush = new SolidBrush(format.BackColor);
                    dc.FillRectangle(brush, cellRect);
                    brush.Dispose();
                }
                cellRect = new Rectangle(cellRect.X + format.Padding.Left, cellRect.Y + format.Padding.Top, cellRect.Width - format.Padding.Left - format.Padding.Right, cellRect.Height - format.Padding.Top - format.Padding.Bottom);
                //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);
            }
        }