Example #1
0
 private void adjustTextPositionByPoint(TextBlock txt, Point pt, DeviceBase dev)
 {
     int flag = PointInLine(pt, dev);
     switch (flag)
     {
         case 0:
             txt.SetValue(Canvas.LeftProperty, pt.X);
             txt.SetValue(Canvas.TopProperty, pt.Y - txt.ActualHeight - 10);
             break;
         case 1:
             txt.SetValue(Canvas.LeftProperty, pt.X - txt.ActualWidth - 20);
             txt.SetValue(Canvas.TopProperty, pt.Y);
             break;
         case 2:
             txt.SetValue(Canvas.LeftProperty, pt.X);
             txt.SetValue(Canvas.TopProperty, pt.Y + dev.GetTxtHeight());
             break;
         case 3:
             txt.SetValue(Canvas.LeftProperty, pt.X);
             txt.SetValue(Canvas.TopProperty, pt.Y);
             break;
     }
 }