private void SetItemsPos() { double sz; double x; double y; double isz; double ix; double iy; CalcCoos(out x, out y, out sz, out ix, out iy, out isz); OuterBorder.SetValue(Canvas.LeftProperty, x); OuterBorder.SetValue(Canvas.TopProperty, y); OuterBorder.Width = sz; OuterBorder.Height = sz; InnerBorder.SetValue(Canvas.LeftProperty, ix); InnerBorder.SetValue(Canvas.TopProperty, iy); InnerBorder.Width = isz; InnerBorder.Height = isz; if (Brush != null) { StartPoint.SetValue(Canvas.LeftProperty, ix + Brush.StartPoint.X * isz - StartPoint.Width / 2.0); StartPoint.SetValue(Canvas.TopProperty, iy + Brush.StartPoint.Y * isz - StartPoint.Height / 2.0); EndPoint.SetValue(Canvas.LeftProperty, ix + Brush.EndPoint.X * isz - EndPoint.Width / 2.0); EndPoint.SetValue(Canvas.TopProperty, iy + Brush.EndPoint.Y * isz - EndPoint.Height / 2.0); StartEndLine.X1 = ix + Brush.StartPoint.X * isz; StartEndLine.Y1 = iy + Brush.StartPoint.Y * isz; StartEndLine.X2 = ix + Brush.EndPoint.X * isz; StartEndLine.Y2 = iy + Brush.EndPoint.Y * isz; StartPoint.Visibility = Visibility.Visible; EndPoint.Visibility = Visibility.Visible; StartEndLine.Visibility = Visibility.Visible; } else { StartPoint.Visibility = Visibility.Collapsed; EndPoint.Visibility = Visibility.Collapsed; StartEndLine.Visibility = Visibility.Collapsed; } }
private void SetItemsPos() { double sz; double x; double y; double isz; double ix; double iy; CalcCoos(out x, out y, out sz, out ix, out iy, out isz); OuterBorder.SetValue(Canvas.LeftProperty, x); OuterBorder.SetValue(Canvas.TopProperty, y); OuterBorder.Width = sz; OuterBorder.Height = sz; InnerBorder.SetValue(Canvas.LeftProperty, ix); InnerBorder.SetValue(Canvas.TopProperty, iy); InnerBorder.Width = isz; InnerBorder.Height = isz; if (Brush != null) { CenterPoint.SetValue(Canvas.LeftProperty, ix + Brush.Center.X * isz - CenterPoint.Width / 2.0); CenterPoint.SetValue(Canvas.TopProperty, iy + Brush.Center.Y * isz - CenterPoint.Height / 2.0); RadiusXPoint.SetValue(Canvas.LeftProperty, ix + (Brush.Center.X + Brush.RadiusX) * isz - RadiusXPoint.Width / 2.0); RadiusXPoint.SetValue(Canvas.TopProperty, iy + Brush.Center.Y * isz - RadiusXPoint.Height / 2.0); RadiusYPoint.SetValue(Canvas.LeftProperty, ix + Brush.Center.X * isz - RadiusYPoint.Width / 2.0); RadiusYPoint.SetValue(Canvas.TopProperty, iy + (Brush.Center.Y + Brush.RadiusY) * isz - RadiusYPoint.Height / 2.0); OriginXLine.SetValue(Canvas.LeftProperty, ix + Brush.GradientOrigin.X * isz - OriginXLine.Width / 2.0); OriginYLine.SetValue(Canvas.TopProperty, iy + Brush.GradientOrigin.Y * isz - OriginYLine.Height / 2.0); OriginXY.SetValue(Canvas.LeftProperty, ix + Brush.GradientOrigin.X * isz - OriginXY.Width / 2.0); OriginXY.SetValue(Canvas.TopProperty, iy + Brush.GradientOrigin.Y * isz - OriginXY.Height / 2.0); RadialEllipse.SetValue(Canvas.LeftProperty, ix + (Brush.Center.X - Brush.RadiusX) * isz); RadialEllipse.SetValue(Canvas.TopProperty, iy + (Brush.Center.Y - Brush.RadiusY) * isz); RadialEllipse.Width = 2.0 * Brush.RadiusX * isz; RadialEllipse.Height = 2.0 * Brush.RadiusY * isz; CenterPoint.Visibility = Visibility.Visible; RadiusXPoint.Visibility = Visibility.Visible; RadiusYPoint.Visibility = Visibility.Visible; OriginXLine.Visibility = Visibility.Visible; OriginYLine.Visibility = Visibility.Visible; OriginXY.Visibility = Visibility.Visible; RadialEllipse.Visibility = Visibility.Visible; } else { CenterPoint.Visibility = Visibility.Collapsed; RadiusXPoint.Visibility = Visibility.Collapsed; RadiusYPoint.Visibility = Visibility.Collapsed; OriginXLine.Visibility = Visibility.Collapsed; OriginYLine.Visibility = Visibility.Collapsed; OriginXY.Visibility = Visibility.Collapsed; RadialEllipse.Visibility = Visibility.Collapsed; } }