當前位置: 首頁>>代碼示例>>C#>>正文


C# DrawingContext.DrawRectangleGuided方法代碼示例

本文整理匯總了C#中System.Windows.Media.DrawingContext.DrawRectangleGuided方法的典型用法代碼示例。如果您正苦於以下問題:C# DrawingContext.DrawRectangleGuided方法的具體用法?C# DrawingContext.DrawRectangleGuided怎麽用?C# DrawingContext.DrawRectangleGuided使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.DrawingContext的用法示例。


在下文中一共展示了DrawingContext.DrawRectangleGuided方法的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);
			}
		}
開發者ID:JPlenert,項目名稱:Pro1,代碼行數:21,代碼來源:SmartTableControl.cs

示例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);
		}
開發者ID:JPlenert,項目名稱:Pro1,代碼行數:19,代碼來源:SmartTableControl.cs

示例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));
		}
開發者ID:JPlenert,項目名稱:Pro1,代碼行數:35,代碼來源:SmartTableControl.cs

示例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);
		}
開發者ID:JPlenert,項目名稱:Pro1,代碼行數:18,代碼來源:SmartTableControl.cs


注:本文中的System.Windows.Media.DrawingContext.DrawRectangleGuided方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。