110,546
社区成员
发帖
与我相关
我的任务
分享
private Point[] getSelectingPoints()//获取当前选中点的数组
{
int Point_Num = Point_Statistics();//统计当前画布内 所有焊点的数量
Point[] SelectingPoints = new Point[Point_Num];
foreach (UIElement element in Border_Canvas.Children)//遍历当前画布内的点
{
if (element is Ellipse)
{
SolidColorBrush Colors_temp = new SolidColorBrush(Colors.DeepSkyBlue);
bool isDeepSkyBlue = ((element as Ellipse).Fill==Brushes.DeepSkyBlue);
if (isDeepSkyBlue)//判断当前点是不是选中的点 如果是就将数据存入数组
{
Point point_temp = new Point();
point_temp.X = (element as Ellipse).Margin.Left;
point_temp.Y = (element as Ellipse).Margin.Top;
SelectingPoints[i] = point_temp;//将当前点信息存入点数组SelectingPoints[i]
}
}
}
return SelectingPoints;//返回获得的选中的点数组(无序排列,阵列复制也不需要顺序)
}
var solidColorBrush = (element as Ellipse).Fill as SolidColorBrush;
bool isDeepSkyBlue = solidColorBrush != null && solidColorBrush.Color == Colors.DeepSkyBlue;
private Point[] getSelectingPoints()//获取当前选中点的数组
{
int Point_Num = Point_Statistics();//统计当前画布内 所有焊点的数量
Point[] SelectingPoints = new Point[Point_Num];
foreach (UIElement element in Border_Canvas.Children)//遍历当前画布内的点
{
if (element is Ellipse)
{
SolidColorBrush Colors_temp = new SolidColorBrush(Colors.DeepSkyBlue);
bool isDeepSkyBlue = ((element as Ellipse).Fill == Colors_temp);//这里刚刚我实验的 应该是Colors_temp 求指导
if (isDeepSkyBlue)//判断当前点是不是选中的点 如果是就将数据存入数组 为啥判断不成功!!!难道是传地址???
{
Point point_temp = new Point();
point_temp.X = (element as Ellipse).Margin.Left;
point_temp.Y = (element as Ellipse).Margin.Top;
SelectingPoints[i] = point_temp;//将当前点信息存入点数组SelectingPoints[i]
}
}
}
return SelectingPoints;//返回获得的选中的点数组(无序排列,阵列复制也不需要顺序)
}