C# 如何解冻冻结的图形
比方说,我组合了两个几何体C# 如何解冻冻结的图形,c#,wpf,C#,Wpf,比方说,我组合了两个几何体 var combined = Geometry.Combine(geometry1, geometry2, GeometryCombineMode.Intersect, null); if (combined.Figures.Count > 0) combined.Figures[0].IsClosed = false; // throws exception WindowsBase.dll中发生“System.InvalidOperationExce
var combined = Geometry.Combine(geometry1, geometry2, GeometryCombineMode.Intersect, null);
if (combined.Figures.Count > 0)
combined.Figures[0].IsClosed = false; // throws exception
WindowsBase.dll中发生“System.InvalidOperationException”类型的未处理异常
其他信息:无法设置对象“M0”的属性;50,…z',因为它处于只读状态
在调试器中
geometry1.IsFrozen = false;
geometry2.IsFrozen = false;
combined.IsFrozen = false;
combined.Figures.IsFrozen = false;
combined.Figures[0].IsFrozen = true; // wtf?
怎样才能解冻这个数字
我正在试图解决这个问题。正如@pushpraj所评论的,有一种
Clone()
方法来处理这个问题:
var combined = Geometry.Combine(geometry1, geometry2, GeometryCombineMode.Intersect, null);
if (combined.Figures.Count > 0)
{
var figure = combined.Figures[0].Clone();
figure.IsClosed = false;
combined.Figures.RemoveAt(0);
combined.Figures.Insert(0, figure);
}
这是一个新问题还是对你原来问题的更新?如果是后者,那么你最好更新这个问题。@Sayse,yes和yes。这是另外一个问题,可能(我还不知道)解决我原来的问题。原始问题可能有其他解决方案,这就是为什么我决定提出一个新问题,解决更具体的问题。解冻不是一个选项,您可以指定一个新的更新副本。@pushpraj,知道怎么做吗?我找不到
Parse
或Copy
方法。许多类提供克隆方法。因此,如果你能告诉我,做同样的事情的实际需要是什么,我可以试着提出一些解决办法。