Exemplo n.º 1
0
        /// <summary>
        /// Draws a data cell
        /// In the default case the right and button line will be drawn by this method.
        /// The size of the drawrect is not including this both lines.
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="cell"></param>
        /// <param name="colIdx"></param>
        /// <param name="rowIdx"></param>
        /// <param name="drawRect"></param>
        void DrawCell(DrawingContext dc, Cell cell, int colIdx, int rowIdx, Rect drawRect)
        {
            Brush  backgroundBrush;
            string cellText;
            Column column = ColumnList[colIdx];
            Rect   textRect;

            // Get Bk-Color
            backgroundBrush = OnGetBackgroundBrush(colIdx, rowIdx);

            // Get Text
            cellText = OnGetCellText(colIdx, rowIdx);

            dc.DrawRectangleGuided(backgroundBrush, null, drawRect);
            dc.DrawLineGuided(smallLtGrayPen, drawRect.Left, drawRect.Bottom, drawRect.Right + 1, drawRect.Bottom);
            dc.DrawLineGuided(smallLtGrayPen, drawRect.Right, drawRect.Top, drawRect.Right, drawRect.Bottom);

            textRect = new Rect(drawRect.Left + ColumnHeaderMargin.Left, drawRect.Top + ColumnHeaderMargin.Top, drawRect.Width - (ColumnHeaderMargin.Left + ColumnHeaderMargin.Right), drawRect.Height - (ColumnHeaderMargin.Top + ColumnHeaderMargin.Bottom));

            FormattedText text = new FormattedText(cellText, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, Brushes.Black);

            text.MaxTextWidth = textRect.Width;
            text.Trimming     = TextTrimming.None;
            text.MaxLineCount = 1;
            dc.DrawText(text, new Point(textRect.Left + (textRect.Width - text.Width) / 2, drawRect.Top + ColumnHeaderMargin.Top));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Draws a selection button right to the first data column.
        /// In the default case the right and button line will be drawn by this method.
        /// The size of the drawrect is not including this both lines.
        /// </summary>
        /// <param name="dc"></param>
        /// <param name="rowIdx"></param>
        /// <param name="drawRect"></param>
        void DrawRowSelectionButton(DrawingContext dc, int rowIdx, Rect drawRect)
        {
            Brush backgroundBrush;

            // Get Bk-Color
            backgroundBrush = OnGetBackgroundBrush(-1, rowIdx);

            dc.DrawRectangleGuided(backgroundBrush, null, drawRect);
            dc.DrawLineGuided(smallLLtGrayToGrayHPen, drawRect.Left, drawRect.Bottom, drawRect.Right + 1, drawRect.Bottom);
            dc.DrawLineGuided(smallGrayPen, drawRect.TopRight, drawRect.BottomRight);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Draws the box in the upper left corner (pos -1, -1)
        /// </summary>
        /// <param name="dc"></param>
        void DrawCornerBox(DrawingContext dc)
        {
            Brush backgroundBrush;
            Rect  drawRect;

            drawRect = new Rect(0, 0, RowSelectionButtonWidth, ColumnHeaderHeight);

            // Get Bk-Color
            backgroundBrush = OnGetBackgroundBrush(-1, -1);

            dc.DrawRectangleGuided(backgroundBrush, null, drawRect);
            dc.DrawLineGuided(smallLLtGrayToGrayVPen, drawRect.Right, drawRect.Top, drawRect.Right, drawRect.Bottom + 1);
            dc.DrawLineGuided(smallLLtGrayToGrayHPen, drawRect.BottomLeft, drawRect.BottomRight);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Draws all column header
        /// </summary>
        /// <param name="dc"></param>
        void DrawColumnHeaders(DrawingContext dc)
        {
            double curX = RowSelectionButtonWidth + 1 - scrollXOffset;

            for (int colIdx = 0; colIdx < ColumnList.Count; colIdx++)
            {
                //drawingContext.DrawLine(myPen, new Point(curX, 0), new Point(curX, this.Height));
                DrawColumnHeader(dc, colIdx, new Rect(curX, 0, ColumnList[colIdx].Width, ColumnHeaderHeight));
                curX += ColumnList[colIdx].Width + 1;
            }

            // Check if rest table header (right) must be dawn
            if (curX < Width)
            {
                dc.DrawRectangleGuided(ColumnHeaderDefaultBackgroundBrush, null, new Rect(curX, 0, Width - curX, ColumnHeaderHeight));
                dc.DrawLineGuided(smallGrayPen, curX, ColumnHeaderHeight, curX + Width - curX, ColumnHeaderHeight);
            }
        }