本文整理汇总了C#中System.Windows.Media.DrawingContext.DrawLineGuided方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingContext.DrawLineGuided方法的具体用法?C# DrawingContext.DrawLineGuided怎么用?C# DrawingContext.DrawLineGuided使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.DrawingContext
的用法示例。
在下文中一共展示了DrawingContext.DrawLineGuided方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawColumnHeaders
/// <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);
}
}
示例2: DrawRowSelectionButton
/// <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);
}
示例3: DrawCell
/// <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));
}
示例4: DrawCornerBox
/// <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);
}