终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ImageBorder.xaml.cs 2.5 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace BPASmartClient.CustomResource.UserControls
  16. {
  17. /// <summary>
  18. /// ImageBorder.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class ImageBorder : UserControl
  21. {
  22. public ImageBorder()
  23. {
  24. InitializeComponent();
  25. this.SizeChanged += ImageBorder_SizeChanged;
  26. }
  27. private void ImageBorder_SizeChanged(object sender, SizeChangedEventArgs e)
  28. {
  29. double min = Math.Min(this.Width, this.Height);
  30. PathGeometry geometry = new PathGeometry();
  31. PathFigure pathFigure = new PathFigure();
  32. pathFigure.StartPoint = new Point(15, 0);
  33. pathFigure.Segments.Add(new LineSegment(new Point(0, 0), true));
  34. pathFigure.Segments.Add(new LineSegment(new Point(0, 15), true));
  35. geometry.Figures.Add(pathFigure);
  36. this.leftTop.Data = geometry;
  37. geometry = new PathGeometry();
  38. pathFigure = new PathFigure();
  39. pathFigure.StartPoint = new Point(this.Width - 15, 0);
  40. pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true));
  41. pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 15), true));
  42. geometry.Figures.Add(pathFigure);
  43. this.rightTop.Data = geometry;
  44. geometry = new PathGeometry();
  45. pathFigure = new PathFigure();
  46. pathFigure.StartPoint = new Point(0, this.Height - 15);
  47. pathFigure.Segments.Add(new LineSegment(new Point(0, this.Height), true));
  48. pathFigure.Segments.Add(new LineSegment(new Point(15, this.Height), true));
  49. geometry.Figures.Add(pathFigure);
  50. this.leftBottom.Data = geometry;
  51. geometry = new PathGeometry();
  52. pathFigure = new PathFigure();
  53. pathFigure.StartPoint = new Point(this.Width - 15, this.Height);
  54. pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true));
  55. pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - 15), true));
  56. geometry.Figures.Add(pathFigure);
  57. this.rightBottom.Data = geometry;
  58. }
  59. }
  60. }