Example #1
0
 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);
 }