|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
-
- namespace BPASmartClient.CustomResource.UserControls
- {
- /// <summary>
- /// ImageBorder.xaml 的交互逻辑
- /// </summary>
- public partial class ImageBorder : UserControl
- {
- public ImageBorder()
- {
- InitializeComponent();
- this.SizeChanged += ImageBorder_SizeChanged;
- }
-
- private void ImageBorder_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- double min = Math.Min(this.Width, this.Height);
-
- PathGeometry geometry = new PathGeometry();
- PathFigure pathFigure = new PathFigure();
- pathFigure.StartPoint = new Point(15, 0);
- pathFigure.Segments.Add(new LineSegment(new Point(0, 0), true));
- pathFigure.Segments.Add(new LineSegment(new Point(0, 15), true));
- geometry.Figures.Add(pathFigure);
- this.leftTop.Data = geometry;
-
- geometry = new PathGeometry();
- pathFigure = new PathFigure();
- pathFigure.StartPoint = new Point(this.Width - 15, 0);
- pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true));
- pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 15), true));
- geometry.Figures.Add(pathFigure);
- this.rightTop.Data = geometry;
-
- geometry = new PathGeometry();
- pathFigure = new PathFigure();
- pathFigure.StartPoint = new Point(0, this.Height - 15);
- pathFigure.Segments.Add(new LineSegment(new Point(0, this.Height), true));
- pathFigure.Segments.Add(new LineSegment(new Point(15, this.Height), true));
- geometry.Figures.Add(pathFigure);
- this.leftBottom.Data = geometry;
-
- geometry = new PathGeometry();
- pathFigure = new PathFigure();
- pathFigure.StartPoint = new Point(this.Width - 15, this.Height);
- pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true));
- pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - 15), true));
- geometry.Figures.Add(pathFigure);
- this.rightBottom.Data = geometry;
-
- }
- }
- }
|