当前位置: 首页>>代码示例>>C#>>正文


C# Ellipse.GetValue方法代码示例

本文整理汇总了C#中System.Windows.Shapes.Ellipse.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Ellipse.GetValue方法的具体用法?C# Ellipse.GetValue怎么用?C# Ellipse.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Shapes.Ellipse的用法示例。


在下文中一共展示了Ellipse.GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetEllipsePosition

        static private void SetEllipsePosition(Ellipse ellipse, Joint joint)
        {
            var scaledJoint = joint.ScaleTo(1500, 900, k_xMaxJointScale, k_yMaxJointScale);

            Canvas.SetLeft(ellipse, scaledJoint.Position.X - (double)ellipse.GetValue(Canvas.WidthProperty) / 2);
            Canvas.SetTop(ellipse, scaledJoint.Position.Y - (double)ellipse.GetValue(Canvas.WidthProperty) / 2);
            Canvas.SetZIndex(ellipse, (int)Math.Floor(scaledJoint.Position.Z * 100));
            /*if (joint.ID == JointID.HandLeft || joint.ID == JointID.HandRight)
            {
                byte val = (byte)(Math.Floor((joint.Position.Z - 0.8) * 255 / 2));
                ellipse.Fill = new SolidColorBrush(System.Windows.Media.Color.FromRgb(val, val, val));
            }*/
        }
开发者ID:cattron313,项目名称:CS194W,代码行数:13,代码来源:Page8.xaml.cs

示例2: SetEllipsePosition

        private void SetEllipsePosition(Ellipse ellipse, Joint joint)
        {
            var scaledJoint = joint.ScaleTo(1024, 1280, k_xMaxJointScale, k_yMaxJointScale);

            Canvas.SetLeft(ellipse, scaledJoint.Position.X - (double)ellipse.GetValue(Canvas.WidthProperty) / 2);
            Canvas.SetTop(ellipse, scaledJoint.Position.Y - (double)ellipse.GetValue(Canvas.WidthProperty) / 2);
            Canvas.SetZIndex(ellipse, (int)-Math.Floor(scaledJoint.Position.Z * 100));
            if (joint.JointType == JointType.HandLeft || joint.JointType == JointType.HandRight)
            {
                byte val = (byte)(Math.Floor((joint.Position.Z - 0.8) * 255 / 2));
                ellipse.Fill = new SolidColorBrush(Color.FromRgb(val, val, val));
            }
        }
开发者ID:ardakara,项目名称:Youmote,代码行数:13,代码来源:MainWindow.xaml.cs

示例3: DetectCollision

        //private Storyboard setAnimation(Rectangle rect)
        //{
        //    // Create a duration of 2 seconds.
        //    Duration duration = new Duration(TimeSpan.FromSeconds(1));
        //    ObjectAnimationUsingKeyFrames oA = new ObjectAnimationUsingKeyFrames();
        //    ColorAnimation clorAnimation = new ColorAnimation();
        //    clorAnimation.From = Color.FromArgb(255, Convert.ToByte(new Random().Next(180, 255)), Convert.ToByte(new Random().Next(0, 255)), Convert.ToByte(new Random().Next(0, 255)));
        //    clorAnimation.To = Color.FromArgb(255, Convert.ToByte(new Random().Next(0, 255)), Convert.ToByte(new Random().Next(100, 255)), Convert.ToByte(new Random().Next(0, 255)));
        //    clorAnimation.Duration = duration;
        //    clorAnimation.AutoReverse = true;
        //    clorAnimation.RepeatBehavior = RepeatBehavior.Forever;
        //    LinearGradientBrush tempBrush = new LinearGradientBrush();
        //    tempBrush.StartPoint = new Point(0, 0);
        //    tempBrush.EndPoint = new Point(1, 1);
        //    GradientStop gs = new GradientStop();
        //    gs.Color = Color.FromArgb(Convert.ToByte(new Random().Next(100, 255)), Convert.ToByte(new Random().Next(200, 255)), Convert.ToByte(new Random().Next(50, 255)), Convert.ToByte(new Random().Next(0, 120)));
        //    gs.Offset = 0.25;
        //    tempBrush.GradientStops.Add(gs);
        //    gs = new GradientStop();
        //    gs.Color = Color.FromArgb(Convert.ToByte(new Random().Next(100, 255)), Convert.ToByte(new Random().Next(200, 255)), Convert.ToByte(new Random().Next(100, 255)), Convert.ToByte(new Random().Next(0, 120)));
        //    gs.Offset = 0.55;
        //    gs = new GradientStop();
        //    gs.Color = Color.FromArgb(Convert.ToByte(new Random().Next(100, 255)), Convert.ToByte(new Random().Next(200, 255)), Convert.ToByte(new Random().Next(150, 255)), Convert.ToByte(new Random().Next(0, 120)));
        //    gs.Offset = 0.75;
        //    tempBrush.GradientStops.Add(gs);
        //    rect.Fill = tempBrush;
        //    Storyboard sb = new Storyboard();
        //    sb.AutoReverse = true;
        //    sb.RepeatBehavior = RepeatBehavior.Forever;
        //    sb.Duration = duration;
        //    sb.Children.Add(clorAnimation);
        //    Storyboard.SetTarget(clorAnimation, gs);
        //    Storyboard.SetTargetProperty(clorAnimation, new PropertyPath(GradientStop.ColorProperty));
        //    return sb;
        //}
        public static Int16 DetectCollision(Canvas cnv,Ellipse els, Double speedX, Double speedY)
        {
            Int16 dir = 0;
            Double ballX = Convert.ToDouble(els.GetValue(Canvas.LeftProperty));
            Double ballY = Convert.ToDouble(els.GetValue(Canvas.TopProperty));
            for (int i = 0; i < rectList.Count; i++)
            {
                Rectangle tempRect = rectList.ElementAt(i);
                Double x = Convert.ToDouble(tempRect.Tag.ToString().Split(',').ElementAt(1));
                Double y = Convert.ToDouble(tempRect.Tag.ToString().Split(',').ElementAt(0));
                if (ballY + els.Height > y && ballY + els.Height < y + height / 16 && ballX + els.Width / 2 > x && ballX + els.Width / 2 < x + width / 16)
                {
                    dir += 2;
                    cnv.Children.Remove(tempRect);
                    rectList.Remove(tempRect);
                    cnv.Resources.Remove("sotryboard" + tempRect.Tag);
                    SoundManager.BrickSound();
                    if (rectList.Count == 0)
                    {
                        saveLevel();
                        dir = 9;
                    }
                    break;
                }
                if (ballY < y + height / 16 && ballY > y && ballX + els.Width / 2 > x && ballX + els.Width / 2 < x + width / 16)
                {
                    dir += 2;
                    cnv.Children.Remove(tempRect);
                    rectList.Remove(tempRect);
                    cnv.Resources.Remove("sotryboard" + tempRect.Tag);
                    SoundManager.BrickSound();
                    if (rectList.Count == 0)
                    {
                        saveLevel();
                        dir = 9;
                    }
                    break;
                }

                if (ballX + els.Width > x && ballX + width < x + width / 16 && ballY + els.Height / 2 > y && ballY + els.Height / 2 < y + height / 16)
                {
                    dir += 1;
                    cnv.Children.Remove(tempRect);
                    rectList.Remove(tempRect);
                    cnv.Resources.Remove("sotryboard" + tempRect.Tag);
                    SoundManager.BrickSound();
                    if (rectList.Count == 0)
                    {
                        saveLevel();
                        dir = 9;
                    }
                    break;
                }
                if (ballX < x + width / 16 && ballX > x && ballY + els.Height / 2 > y && ballY + els.Height / 2 < y + height / 16)
                {
                    dir += 1;
                    cnv.Children.Remove(tempRect);
                    rectList.Remove(tempRect);
                    cnv.Resources.Remove("sotryboard" + tempRect.Tag);
                    SoundManager.BrickSound();
                    if (rectList.Count == 0)
                    {
                        saveLevel();
                        dir = 9;
                    }
//.........这里部分代码省略.........
开发者ID:Chengxuan,项目名称:BreakIt,代码行数:101,代码来源:CanvasSetup.cs


注:本文中的System.Windows.Shapes.Ellipse.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。