本文整理汇总了C#中System.Windows.Controls.UIElementCollection.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# UIElementCollection.Contains方法的具体用法?C# UIElementCollection.Contains怎么用?C# UIElementCollection.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.UIElementCollection
的用法示例。
在下文中一共展示了UIElementCollection.Contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(UIElementCollection children)
{
if (!isAlive)
return;
Label l1 = new Label();
l1.Content = "";
l1.FontSize = 16;
l1.Foreground = System.Windows.Media.Brushes.White;
children.Add(l1);
// Draw all bones first, then circles (head and hands).
DateTime cur = DateTime.Now;
foreach (var segment in segments)
{
Segment seg = segment.Value.GetEstimatedSegment(cur);
if (!seg.IsCircle())
{
if (skin.bones.ContainsKey(segment.Key.GetBoneID()) /*&& segment.Key.GetBoneID() == Bone.BoneID.ForearmLeft*/)
{
Image bone = skin.bones[segment.Key.GetBoneID()];
TransformGroup trans = new TransformGroup();
double y = seg.y1 - seg.y2;
double x = seg.x1 - seg.x2;
double r = Math.Sqrt(y*y + x*x);
bone.Stretch = Stretch.Uniform;
if (segment.Key.GetBoneID() == Bone.BoneID.HandLeft || segment.Key.GetBoneID() == Bone.BoneID.HandRight)
r = r * 2;
if (r > 30)
bone.Height = r;
else
bone.Height = 30;
if (segment.Key.GetBoneID() == Bone.BoneID.Torso)
bone.Height = bone.Height * 1.6;
bone.SetValue(Canvas.LeftProperty, seg.x2 - (bone.ActualWidth / 2.0));
bone.SetValue(Canvas.TopProperty, seg.y2);
RotateTransform rotate = new RotateTransform();
rotate.Angle = (Math.Atan2(y,x) * (180 / Math.PI)) - 90;
l1.Content = Math.Atan2(x,y) + " --> "+ rotate.Angle.ToString();
rotate.CenterX = bone.ActualWidth / 2.0;
rotate.CenterY = 0;
trans.Children.Add(rotate);
bone.RenderTransform = trans;
if (!children.Contains(bone))
children.Add(bone);
}
if (MainWindow.ShowSkeleton) {
var line = new Line();
line.StrokeThickness = seg.radius * 2;
line.X1 = seg.x1;
line.Y1 = seg.y1;
line.X2 = seg.x2;
line.Y2 = seg.y2;
line.Stroke = brBones;
line.StrokeEndLineCap = PenLineCap.Round;
line.StrokeStartLineCap = PenLineCap.Round;
var label = new Label();
label.Content = segment.Key.joint1;
label.SetValue(Canvas.LeftProperty, seg.x1);
label.SetValue(Canvas.TopProperty, seg.y1);
children.Add(label);
children.Add(line);
}
}
}
foreach (var segment in segments)
{
Segment seg = segment.Value.GetEstimatedSegment(cur);
if (seg.IsCircle())
{
if (skin.joints.ContainsKey(segment.Key.joint1) /*&& segment.Key.GetBoneID() == Bone.BoneID.Torso*/)
{
Image joint = skin.joints[segment.Key.joint1];
TransformGroup trans = new TransformGroup();
double y = seg.y1;
double x = seg.x1;
double hyp = seg.radius * 3.7;
joint.Stretch = Stretch.Uniform;
if (hyp > 30)
joint.Height = hyp;
else
joint.Height = 30;
joint.SetValue(Canvas.LeftProperty, seg.x1 - (joint.ActualWidth / 2.0));
joint.SetValue(Canvas.TopProperty, seg.y1 - (joint.ActualHeight / 2.0));
//.........这里部分代码省略.........