当前位置: 首页>>代码示例>>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;未经允许,请勿转载。