本文整理匯總了C#中System.Windows.Controls.TextBlock.get_ActualWidth方法的典型用法代碼示例。如果您正苦於以下問題:C# TextBlock.get_ActualWidth方法的具體用法?C# TextBlock.get_ActualWidth怎麽用?C# TextBlock.get_ActualWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Controls.TextBlock
的用法示例。
在下文中一共展示了TextBlock.get_ActualWidth方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}