本文整理汇总了C#中System.Windows.Controls.TextBlock.set_FontSize方法的典型用法代码示例。如果您正苦于以下问题:C# TextBlock.set_FontSize方法的具体用法?C# TextBlock.set_FontSize怎么用?C# TextBlock.set_FontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.TextBlock
的用法示例。
在下文中一共展示了TextBlock.set_FontSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawCurveTitle
private double DrawCurveTitle(Rectangle rc, PointData dpt1, PointData dpt2, string title, bool draw)
{
Point point3;
Point point4;
PointData data;
Point point = this.PointData2Point(dpt1, rc);
Point point2 = this.PointData2Point(dpt2, rc);
if (point.get_X() < point2.get_X())
{
point3 = point;
point4 = point2;
data = dpt1;
}
else
{
point3 = point2;
point4 = point;
data = dpt2;
}
Color color = _SilverlightHelper.ConvertToColor(dpt2.Color);
if (dpt1.DateTime > dpt2.DateTime)
{
color = _SilverlightHelper.ConvertToColor(dpt1.Color);
}
double rotationAngle = _SilverlightHelper.GetRotationAngle(point3, point4);
TextBlock block = new TextBlock();
int num2 = 100;
double num3 = 5.0;
block.SetValue(Canvas.TopProperty, point3.get_Y() + num3);
block.SetValue(Canvas.LeftProperty, point3.get_X() + num3);
block.SetValue(FrameworkElement.WidthProperty, (double) num2);
block.SetValue(FrameworkElement.HeightProperty, 50.0);
block.set_Width((double) num2);
block.set_Text(title);
block.set_FontSize(12.0);
block.set_FontFamily(new FontFamily("Arial"));
block.set_Foreground(new SolidColorBrush(color));
block.set_FontStyle(FontStyles.get_Normal());
block.set_FontWeight(FontWeights.get_Bold());
RotateTransform transform = new RotateTransform();
transform.set_Angle(-rotationAngle);
block.set_RenderTransform(transform);
block.set_TextAlignment(1);
if (draw)
{
this.CanvasRoot.get_Children().Add(block);
}
return (block.get_ActualWidth() + num3);
}
示例2: DrawScales
private void DrawScales(Rectangle rc, List<MarkerData> s, double lastRightStationPosition, double firstLeftStationXPos)
{
DateTime timeStart = this.m_tgd.TimeStart;
TimeSpan span = TimeSpan.FromMinutes(1.0);
double num = 16.0;
double num2 = 18.0;
double num3 = 5.0;
while (timeStart <= this.m_tgd.TimeStop)
{
double y = this.DateTime2PointY(timeStart, rc);
if ((timeStart.Minute == 0) || ((timeStart.Minute % 10) == 0))
{
this.DrawHorScaleLine(rc, y);
this.DrawStationTimeScale(y, s, true);
TextBlock block = new TextBlock();
block.SetValue(Canvas.TopProperty, y - (num2 / 2.0));
block.SetValue(Canvas.LeftProperty, ((firstLeftStationXPos - num) - num3) - 1.0);
block.SetValue(FrameworkElement.WidthProperty, num);
block.SetValue(FrameworkElement.HeightProperty, num2);
block.set_TextAlignment(0);
TextBlock block2 = new TextBlock();
block2.SetValue(Canvas.TopProperty, y - (num2 / 2.0));
block2.SetValue(Canvas.LeftProperty, (lastRightStationPosition + num3) + 2.0);
block2.SetValue(FrameworkElement.WidthProperty, num);
block2.SetValue(FrameworkElement.HeightProperty, num2);
block2.set_TextAlignment(0);
if (timeStart.Minute == 0)
{
block.set_Text(timeStart.Hour.ToString("00"));
block.set_FontSize(15.0);
block.set_FontFamily(new FontFamily("Arial"));
block.set_Foreground(new SolidColorBrush(Colors.get_Black()));
block.set_FontStyle(FontStyles.get_Normal());
block.set_FontWeight(FontWeights.get_Bold());
}
else if ((timeStart.Minute % 10) == 0)
{
block.set_Text(timeStart.Minute.ToString());
block.set_FontSize(13.0);
block.set_FontFamily(new FontFamily("Arial"));
block.set_Foreground(new SolidColorBrush(Colors.get_Gray()));
block.set_FontStyle(FontStyles.get_Normal());
block.set_FontWeight(FontWeights.get_Normal());
}
block2.set_Text(block.get_Text());
block2.set_FontStyle(block.get_FontStyle());
block2.set_FontWeight(block.get_FontWeight());
block2.set_FontSize(block.get_FontSize());
block2.set_FontFamily(block.get_FontFamily());
block2.set_Foreground(block.get_Foreground());
this.CanvasRoot.get_Children().Add(block);
this.CanvasRoot.get_Children().Add(block2);
}
else
{
this.DrawStationTimeScale(y, s, false);
}
timeStart = timeStart.Add(span);
}
}
示例3: DrawCurve
private void DrawCurve(TrainCurveData c, Rectangle rc, List<Line> rectangles, int startIndex)
{
if ((c != null) && (c.Points != null))
{
PointData data;
PointData data2;
int num = 0;
int num2 = -1;
Line item = new Line();
Color color = Colors.get_Black();
double widthRequires = 0.0;
if (c.Points.Count > 0)
{
widthRequires = this.DrawCurveTitle(rc, c.Points[0], c.Points[0], c.Caption, false);
}
for (int i = startIndex; i < (c.Points.Count - 1); i++)
{
data = c.Points[i];
data2 = c.Points[i + 1];
if (!c.Regular)
{
TimeSpan span = (TimeSpan) (data.DateTime - data2.DateTime);
if (this.IsGap((double) (data.Position - data2.Position), span.TotalMinutes))
{
c.CaptionHasDrawn = false;
c.CaptionStartIndex = i + 1;
continue;
}
}
color = _SilverlightHelper.ConvertToColor(data2.Color);
Line line2 = new Line();
line2.set_X1(this.Position2PointX(data.Position, rc));
line2.set_Y1(this.DateTime2PointY(data.DateTime, rc));
line2.set_X2(this.Position2PointX(data2.Position, rc));
line2.set_Y2(this.DateTime2PointY(data2.DateTime, rc));
line2.set_Width(1251.0);
line2.set_Height(this.CanvasRoot_ActualHeight);
line2.set_StrokeThickness(2.0);
line2.set_Stroke(new SolidColorBrush(color));
this.CanvasRoot.get_Children().Add(line2);
if (c.Regular && (c.Caption.Length > 0))
{
if (!this.HasInsersection(rectangles, line2))
{
int num5 = data2.Position - data.Position;
if (num5 > num)
{
num = num5;
num2 = i;
item = this.LineClone(line2);
}
}
}
else if (!c.CaptionHasDrawn)
{
int num6;
int num7;
int num8;
bool flag;
if (this.GetGoodPointsForTitle(c, c.CaptionStartIndex, rc, widthRequires, out num6, out num7, out num8, out flag))
{
c.CaptionHasDrawn = true;
this.DrawCurveTitle(rc, c.Points[num6], c.Points[num7], c.Caption, true);
}
else if (flag)
{
c.CaptionStartIndex = num8;
}
}
}
if ((c.Regular && (c.Caption.Length > 0)) && (num2 != -1))
{
data = c.Points[num2];
data2 = c.Points[num2 + 1];
color = _SilverlightHelper.ConvertToColor(data2.Color);
if (rectangles != null)
{
rectangles.Add(item);
}
Point point = new Point();
Point point2 = new Point();
point.set_X(this.Position2PointX(data.Position, rc));
point.set_Y(this.DateTime2PointY(data.DateTime, rc));
point2.set_X(this.Position2PointX(data2.Position, rc));
point2.set_Y(this.DateTime2PointY(data2.DateTime, rc));
double rotationAngle = _SilverlightHelper.GetRotationAngle(point, point2);
double num10 = point2.get_X() - point.get_X();
TextBlock block = new TextBlock();
block.SetValue(Canvas.TopProperty, point.get_Y() + 5.0);
block.SetValue(Canvas.LeftProperty, point.get_X());
block.SetValue(FrameworkElement.WidthProperty, num10);
block.SetValue(FrameworkElement.HeightProperty, 50.0);
block.set_Width(num10);
block.set_Text(c.Caption);
block.set_FontSize(17.0);
block.set_FontFamily(new FontFamily("Arial"));
block.set_Foreground(new SolidColorBrush(color));
block.set_FontStyle(FontStyles.get_Normal());
block.set_FontWeight(FontWeights.get_Bold());
RotateTransform transform = new RotateTransform();
//.........这里部分代码省略.........