终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

60 righe
1.6 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Data;
  9. using System.Windows.Media;
  10. namespace BPASmartClient.CustomResource.UserControls
  11. {
  12. public class Style3ArcConverter :IMultiValueConverter
  13. {
  14. public object Convert(object[] values,Type targetType,object parameter,CultureInfo culture)
  15. {
  16. double value = (double)values[0];
  17. double thickness = (double)values[1];
  18. double radius = 40;
  19. double 周长 = Math.PI * (2 * radius - thickness) / thickness;
  20. double showPrecent = value / 100 * 周长;
  21. var converter = TypeDescriptor.GetConverter(typeof(DoubleCollection));
  22. return (DoubleCollection)converter.ConvertFrom($"{showPrecent} {周长}");
  23. }
  24. public object[] ConvertBack(object value,Type[] targetTypes,object parameter,CultureInfo culture)
  25. {
  26. throw new NotImplementedException();
  27. }
  28. }
  29. public class Style3DashConverter :IValueConverter
  30. {
  31. public object Convert(object value,Type targetType,object parameter,CultureInfo culture)
  32. {
  33. double v = (double)value;
  34. if (v == 0)
  35. {
  36. return PenLineCap.Flat;
  37. }
  38. else
  39. {
  40. return PenLineCap.Round;
  41. }
  42. }
  43. public object ConvertBack(object value,Type targetType,object parameter,CultureInfo culture)
  44. {
  45. throw new NotImplementedException();
  46. }
  47. }
  48. }