本文整理汇总了C#中Text.SetLabelStyle方法的典型用法代码示例。如果您正苦于以下问题:C# Text.SetLabelStyle方法的具体用法?C# Text.SetLabelStyle怎么用?C# Text.SetLabelStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text.SetLabelStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChartOnFillSceneGraph
private static void ChartOnFillSceneGraph(object sender, FillSceneGraphEventArgs e)
{
var axisY = e.Grid["Y"] as IAdvanceAxis;
var axisX = e.Grid["X"] as IAdvanceAxis;
int targetYCoord = Convert.ToInt32(axisY.Map(0));
int xStart = Convert.ToInt32(axisX.MapMinimum);
int xEnd = Convert.ToInt32(axisX.MapMaximum);
int yStart = Convert.ToInt32(axisY.MapMinimum);
int yEnd = Convert.ToInt32(axisY.MapMaximum);
Line targetLine = new Line(new Point(xStart, targetYCoord), new Point(xEnd, targetYCoord))
{
PE =
{
Stroke = Color.Green,
StrokeWidth = 2
},
lineStyle =
{
DrawStyle = LineDrawStyle.Solid
}
};
e.SceneGraph.Add(targetLine);
var waermerLabel = new Text();
waermerLabel.SetTextString("wärmer");
waermerLabel.SetLabelStyle(new LabelStyle { FontColor = Color.Black, Font = new Font("Verdana", 8, FontStyle.Regular, GraphicsUnit.Point) });
Size waermerLabelSize = Size.Ceiling(Platform.GetLabelSizePixels(waermerLabel.GetTextString(), waermerLabel.labelStyle));
waermerLabel.bounds = new Rectangle(xStart + 5, yEnd - waermerLabelSize.Height, waermerLabelSize.Width, waermerLabelSize.Height);
e.SceneGraph.Add(waermerLabel);
var kaelterLabel = new Text();
kaelterLabel.SetTextString("kälter");
kaelterLabel.SetLabelStyle(new LabelStyle { FontColor = Color.Black, Font = new Font("Verdana", 8, FontStyle.Regular, GraphicsUnit.Point) });
Size kaelterLabelSize = Size.Ceiling(Platform.GetLabelSizePixels(kaelterLabel.GetTextString(), kaelterLabel.labelStyle));
kaelterLabel.bounds = new Rectangle(xStart + 5, yStart , kaelterLabelSize.Width, kaelterLabelSize.Height);
e.SceneGraph.Add(kaelterLabel);
}
示例2: ChartOnFillSceneGraph
private static void ChartOnFillSceneGraph(object sender, FillSceneGraphEventArgs e)
{
//List<Primitive> boxes = e.SceneGraph.Cast<Primitive>().Where(p => p is Box && p.Row > -1).ToList();
//foreach (var box in boxes)
//{
// Point loc = ((Box)box).rect.Location;
// //loc.Offset(((Box)box).rect.Width, ((Box)box).rect.Height);
// loc.Offset(0, -20);
// //Rectangle rect = new Rectangle(loc, new Size(((Box)box).rect.Width, 25));
// Text t = new Text(loc, box.Value.ToString());
// t.SetLabelStyle(new LabelStyle { FontColor = Color.Black });
// // new LabelStyle(this.Font, Color.Black, false, false, false, StringAlignment.Center, StringAlignment.Center, TextOrientation.Horizontal));
// //e.SceneGraph.Add(t);
//}
var chart = sender as UltraChartEx;
if (chart == null)
{
return;
}
var data = chart.ExtraData as MeteoGtzYear;
var relativeData = data.ToRelativeData();
var relativeDataForChart = data.ToRelativeDataForChart();
//Aktuelles Jahr
var aktuellJahr = relativeDataForChart.Period1;
var lgtz = relativeDataForChart.Lgtz;
var axisY = e.Grid["Y"] as IAdvanceAxis;
var axisX = e.Grid["X"] as IAdvanceAxis;
int targetYCoord = Convert.ToInt32(axisY.Map(lgtz));
int aktuellJahrY = Convert.ToInt32(axisY.Map(aktuellJahr));
int nullY = Convert.ToInt32(axisY.Map(0));
var margin = MarginX * 3.5;
if (!isPdf)
{
margin = MarginX * 6.2;
}
int xStart = Convert.ToInt32(axisX.MapMinimum - margin);
int xEnd = Convert.ToInt32(axisX.MapMaximum + margin + (isPdf ? 32 :15));
Line nullLine = new Line(new Point(xStart, nullY), new Point(xEnd, nullY))
{
PE =
{
Stroke = Color.Black,
StrokeWidth = 1
},
lineStyle =
{
DrawStyle = LineDrawStyle.Solid
}
};
e.SceneGraph.Add(nullLine);
var annLabel = new Text();
annLabel.SetTextString(GetAnnotationText(relativeData.Lgtz, "das Langzeitmittel" + Environment.NewLine + "ist"));
annLabel.SetLabelStyle(new LabelStyle { FontColor = Constants.YearsChartColors[3], Font = new Font("Verdana", isPdf ? 6f : 8.5f, FontStyle.Italic, GraphicsUnit.Point) });
Size annLabelSize = Size.Ceiling(Platform.GetLabelSizePixels(annLabel.GetTextString(), annLabel.labelStyle));
annLabel.bounds = new Rectangle(xEnd - annLabelSize.Width, targetYCoord - annLabelSize.Height / 2, annLabelSize.Width, annLabelSize.Height);
e.SceneGraph.Add(annLabel);
Line targetLine = new Line(new Point(xStart, targetYCoord), new Point(xEnd - annLabelSize.Width - 2, targetYCoord))
{
PE =
{
Stroke = Constants.YearsChartColors[3],
StrokeWidth = 2
},
lineStyle =
{
DrawStyle = LineDrawStyle.Dash
}
};
e.SceneGraph.Add(targetLine);
var targetLabel = new Text();
targetLabel.SetTextString("Langzeitmittel");
targetLabel.SetLabelStyle(new LabelStyle { FontColor = Constants.YearsChartColors[3] });
Size targetLabelSize = Size.Ceiling(Platform.GetLabelSizePixels(targetLabel.GetTextString(), targetLabel.labelStyle));
targetLabel.bounds = new Rectangle(xStart - (targetLabelSize.Width - (isPdf ? 10 : 0)), targetYCoord - targetLabelSize.Height / 2, targetLabelSize.Width, targetLabelSize.Height);
e.SceneGraph.Add(targetLabel);
//.........这里部分代码省略.........