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


C# Altaxo.PaintBackground方法代碼示例

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


在下文中一共展示了Altaxo.PaintBackground方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RowHeaderStyle_Paint

		private static void RowHeaderStyle_Paint(Altaxo.Worksheet.RowHeaderStyle thiss, object drawingContext, RectangleD2D cellRect, int nRow, Altaxo.Data.DataColumn data, bool bSelected)
		{
			var dc = (DrawingContext)drawingContext;
			Rect cellRectangle = cellRect.ToWpf();
			thiss.PaintBackground(dc, cellRect, bSelected);

			string text = "[" + nRow + "]";

			var font = WpfFontManager.ToWpf(thiss.TextFont);
			var fontSize = (thiss.TextFont.Size * 96) / 72;
			var txtBrush = bSelected ? thiss.DefaultSelectedTextBrush.ToWpf() : thiss.TextBrush.ToWpf();

			FormattedText t;

			t = new FormattedText(text, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush);
			t.MaxTextWidth = cellRectangle.Width;
			t.TextAlignment = TextAlignment.Center;
			dc.DrawText(t, cellRectangle.Location); // ("[" + nRow + "]", _textFont, _textBrush, cellRectangle, _textFormat);
		}
開發者ID:Altaxo,項目名稱:Altaxo,代碼行數:19,代碼來源:ColumnStylePaintingWpf.cs

示例2: ColumnHeaderStyle_Paint

		private static void ColumnHeaderStyle_Paint(Altaxo.Worksheet.ColumnHeaderStyle thiss, object drawingContext, RectangleD2D cellRect, int nRow, Altaxo.Data.DataColumn data, bool bSelected)
		{
			var dc = (DrawingContext)drawingContext;
			Rect cellRectangle = cellRect.ToWpf();

			thiss.PaintBackground(dc, cellRect, bSelected);

			Altaxo.Data.DataColumnCollection dataColCol = (Altaxo.Data.DataColumnCollection)AbsoluteDocumentPath.GetRootNodeImplementing(data, typeof(Altaxo.Data.DataColumnCollection));
			string columnnumber = dataColCol.GetColumnNumber(data).ToString();
			string kindandgroup = string.Format("({0}{1})", dataColCol.GetColumnKind(data).ToString(), dataColCol.GetColumnGroup(data));
			var font = WpfFontManager.ToWpf(thiss.TextFont);
			var fontSize = (thiss.TextFont.Size * 96) / 72;
			var fontheight = font.FontFamily.LineSpacing * fontSize;
			var nameRectangle = cellRectangle;
			nameRectangle.Height = Math.Max(fontheight, cellRectangle.Height - fontheight);
			var numRectangle = cellRectangle;
			numRectangle.Height = fontheight;
			numRectangle.Y = Math.Max(cellRectangle.Y + cellRectangle.Height - fontheight, cellRectangle.Y);

			var txtBrush = bSelected ? thiss.DefaultSelectedTextBrush.ToWpf() : thiss.TextBrush.ToWpf();

			FormattedText t;

			t = new FormattedText(columnnumber, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush);
			t.MaxTextWidth = numRectangle.Width;
			t.TextAlignment = TextAlignment.Left;
			dc.DrawText(t, numRectangle.Location);

			t = new FormattedText(kindandgroup, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush);
			t.MaxTextWidth = numRectangle.Width;
			t.TextAlignment = TextAlignment.Right;
			dc.DrawText(t, numRectangle.Location);

			t = new FormattedText(data.Name, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush);
			t.MaxTextWidth = nameRectangle.Width;
			t.TextAlignment = TextAlignment.Center;
			dc.DrawText(t, nameRectangle.Location);
		}
開發者ID:Altaxo,項目名稱:Altaxo,代碼行數:38,代碼來源:ColumnStylePaintingWpf.cs

示例3: GeneralText_Paint

		private static void GeneralText_Paint(Altaxo.Worksheet.ColumnStyle thiss, object drawingContext, RectangleD2D cellRect, string textToDraw, TextAlignment alignment, bool bSelected)
		{
			var dc = (DrawingContext)drawingContext;
			Rect cellRectangle = cellRect.ToWpf();

			thiss.PaintBackground(dc, cellRect, bSelected);

			var font = WpfFontManager.ToWpf(thiss.TextFont);
			var fontSize = (thiss.TextFont.Size * 96) / 72;
			var txtBrush = bSelected ? thiss.DefaultSelectedTextBrush.ToWpf() : thiss.TextBrush.ToWpf();

			FormattedText t;
			t = new FormattedText(textToDraw, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush);
			t.MaxTextWidth = cellRect.Width;
			t.TextAlignment = alignment;
			t.Trimming = TextTrimming.CharacterEllipsis;
			dc.DrawText(t, cellRectangle.Location);
		}
開發者ID:Altaxo,項目名稱:Altaxo,代碼行數:18,代碼來源:ColumnStylePaintingWpf.cs


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