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


C# Shapes.Ellipse类代码示例

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


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

示例1: boardCanvas_MouseDown

        public void boardCanvas_MouseDown(object sender, MouseButtonEventArgs e)
        {
            boardCanvas.CaptureMouse();
            sP = e.GetPosition(boardCanvas);
            newAtr.Color = (Color)colorStroke.SelectedColor;
            newAtr.Height = newAtr.Width = slider.Value;
            boardCanvas.DefaultDrawingAttributes = newAtr;

            if (tempTool == pencilImage.Name || tempTool == eraserImage.Name || tempTool == circleImage.Name || tempTool == rectangleImage.Name)
            {

               if (tempTool == circleImage.Name)
                {
                    ellipse = new Ellipse();
                }
                else if (tempTool == rectangleImage.Name)
                {
                    rect = new Rectangle();
                }
            }
            else if (tempTool == lineImage.Name)
            {
                line_C = new Line();
            }

            else if (tempTool == textBoxImage.Name) {
                tB = new TextBox();
            }

            //eP = new Point(0, 0);
        }
开发者ID:asadnadeem93,项目名称:Collaboard,代码行数:31,代码来源:boardPage.xaml.cs

示例2: DraggableCanvas

        public DraggableCanvas()
        {
            m_handles = new Ellipse[4];

            for (int i = 0; i < m_handles.Length; i++)
            {
                m_handles[i] = new Ellipse();

                this.Children.Add(m_handles[i]);

                m_handles[i].Height = SizingHandleSize;
                m_handles[i].Width = SizingHandleSize;
                m_handles[i].StrokeThickness = 2;
                m_handles[i].Fill = new SolidColorBrush(Color.FromArgb(32, 255, 255, 255));
                m_handles[i].Stroke = Brushes.Red;
                m_handles[i].Opacity = 0;
                m_handles[i].IsEnabled = false;

                Canvas.SetZIndex(m_handles[i], 100);
            }

            m_handles[(int)SizingHandles.TopLeft].Cursor = Cursors.SizeNWSE;
            m_handles[(int)SizingHandles.TopRight].Cursor = Cursors.SizeNESW;
            m_handles[(int)SizingHandles.BottomLeft].Cursor = Cursors.SizeNESW;
            m_handles[(int)SizingHandles.BottomRight].Cursor = Cursors.SizeNWSE;
        }
开发者ID:philip-d,项目名称:PaperStitcher,代码行数:26,代码来源:DraggableCanvas.cs

示例3: Star

        public Star()
        {
            centerX = 285;
            centerY = 285;

            starGFX = new Ellipse();
            starSEL = new Ellipse();

            starCanvas = new Canvas();
            starLabel = new Label();

            starSEL.Visibility = Visibility.Hidden;
            starGFX.Fill = backgroundBrush;

            starLabel.FontFamily = new FontFamily(new Uri("pack://application:,,,/Fonts/"), "./#Euro Caps");
            starLabel.Foreground = backgroundBrush;

            starCanvas.Children.Add(starGFX);
            starCanvas.Children.Add(starLabel);
            starCanvas.Children.Add(starSEL);

            movePoint = new Point3D(0,0,0);
            rotaPoint = new Point3D(0,0,0);

            starCanvas.PreviewMouseDown += MoveToSystem;
        }
开发者ID:saturnineNL,项目名称:huiswerk-les-13,代码行数:26,代码来源:Star.cs

示例4: AddPoint

        private void AddPoint(Map controlMap, GeoCoordinate geo)
        {
            // With the new Map control:
            //  Map -> MapLayer -> MapOverlay -> UIElements
            //  - Add a MapLayer to the Map
            //  - Add an MapOverlay to that layer
            //  - We can add a single UIElement to that MapOverlay.Content
            MapLayer ml = new MapLayer();
            MapOverlay mo = new MapOverlay();

            // Add an Ellipse UI
            Ellipse r = new Ellipse();
            r.Fill = new SolidColorBrush(Color.FromArgb(255, 240, 5, 5));
            // the item is placed on the map at the top left corner so
            // in order to center it, we change the margin to a negative
            // margin equal to half the width and height
            r.Width = r.Height = 12;
            r.Margin = new Thickness(-6, -6, 0, 0);

            // Add the Ellipse to the Content 
            mo.Content = r;
            // Set the GeoCoordinate of that content
            mo.GeoCoordinate = geo;
            // Add the MapOverlay to the MapLayer
            ml.Add(mo);
            // Add the MapLayer to the Map
            controlMap.Layers.Add(ml);
        }
开发者ID:natsirt20,项目名称:School,代码行数:28,代码来源:Geolocation.xaml.cs

示例5: KinectController

 public KinectController(DrawController dController, Image image, SoundController sController, Ellipse[] buttons)
 {
     debugImage = image;
     drawController = dController;
     soundController = sController;
     this.buttons = buttons;
 }
开发者ID:ZeyuW,项目名称:eecs481maze,代码行数:7,代码来源:KinectController.cs

示例6: ShowMyLocationOnTheMap

        private async void ShowMyLocationOnTheMap()
        {
            Geolocator myGeolocator = new Geolocator();
            Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
            Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
            GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);

            this.BettingMap.Center = myGeoCoordinate;
            this.BettingMap.ZoomLevel = 15;

            Ellipse myCircle = new Ellipse();
            myCircle.Fill = new SolidColorBrush(Colors.Blue);
            myCircle.Height = 20;
            myCircle.Width = 20;
            myCircle.Opacity = 50;

            MapOverlay myLocationOverlay = new MapOverlay();
            myLocationOverlay.Content = myCircle;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = myGeoCoordinate;

            MapLayer myLocationLayer = new MapLayer();
            myLocationLayer.Add(myLocationOverlay);

            BettingMap.Layers.Add(myLocationLayer);
        }
开发者ID:vlatkooo,项目名称:MyTicket,代码行数:26,代码来源:MainPage.xaml.cs

示例7: Lock

 public Lock(Ellipse ellipse, Canvas canvas, double width)
 {
     _ellipse = ellipse;
     _canvas = canvas;
     _width = width;
     Position = 0;
 }
开发者ID:rechc,项目名称:KinectMiniApps,代码行数:7,代码来源:Lock.cs

示例8: GetMovingPlayer

        /// <summary>
        /// Método que obtiene una instancia 'Player' a partir de un Ellipse
        /// </summary>
        /// <param name="ellipse">Instancia Ellipse que será representada como clase 'Player'</param>
        /// <returns>Instancia Player</returns>
        public static Player GetMovingPlayer(Ellipse ellipse)
        {
            Player currentPlayer = new Player();
            // Se obtiene el color del ellipse
            SolidColorBrush brush = ellipse.Fill as SolidColorBrush;
            // Color que se comparará con el del Ellipse
            Color colorToCompare = new Color()
            {
                A=255,
                B=170,
                G=178,
                R=32
            };

            if (brush.Color == colorToCompare)
            {
                // Es el jugador 1
                currentPlayer.PlayerNumber = PlayerNum.PlayerOne;
            }
            else
            {
                // Es el jugador 2
                currentPlayer.PlayerNumber = PlayerNum.PlayerTwo;
            }
            // Se guarda el Ellipse en la instancia Player
            currentPlayer.Shape = ellipse;

            return currentPlayer;
        }
开发者ID:vmandrade,项目名称:Tareas,代码行数:34,代码来源:GameEngine.cs

示例9: BuildAddButton

 private Grid BuildAddButton()
 {
     Grid g = new Grid();
     g.Width = 120;
     g.Height = 120;
     g.Margin = new Thickness(0, 0, 10, 10);
     Rectangle r = new Rectangle();
     r.Fill = new SolidColorBrush(Color.FromArgb(0x33, 0xFF, 0xFF, 0xFF));
     g.Children.Add(r);
     TextBlock t = new TextBlock();
     t.Text = "+";
     t.VerticalAlignment = VerticalAlignment.Center;
     t.HorizontalAlignment = HorizontalAlignment.Center;
     t.TextAlignment = TextAlignment.Center;
     t.FontSize = 60;
     t.Margin = new Thickness(0, -15, 0, 0);
     g.Children.Add(t);
     Ellipse e = new Ellipse();
     e.Stroke = new SolidColorBrush(Colors.White);
     e.Fill = new SolidColorBrush(Colors.Transparent);
     e.StrokeThickness = 3;
     e.Margin = new Thickness(30);
     g.Children.Add(e);
     return g;
 }
开发者ID:jeffblankenburg,项目名称:FanaticApp,代码行数:25,代码来源:MainPage.xaml.cs

示例10: MensSpeler

        public MensSpeler()
            : base()
        {
            kleur = "Red";

            bol = new Ellipse();
            bol.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(kleur));

            bol.Width = grote;
            bol.Height = grote;

            xRand = new Random();
            yRand = new Random();

            positie.X = xRand.Next(0, 631);
            positie.Y = yRand.Next(0, 278);

            xChange = xRand.Next(-2, 2);
            while(xChange == 0)
            {
                xChange = xRand.Next(-2, 2);
            }
            yChange = yRand.Next(-2, 2);
            while (xChange == 0)
            {
                yChange = yRand.Next(-2, 2);
            }
        }
开发者ID:JasperSzkudlarski,项目名称:ProjectChallenge,代码行数:28,代码来源:MensSpeler.cs

示例11: canvasDrawingArea_MouseLeftButtonDown

        private void canvasDrawingArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Shape shapeToRender = null;

            // Configure the correct shape to draw.
            switch (currentShape)
            {
                case SelectedShape.Circle:
                    shapeToRender = new Ellipse() { Fill = Brushes.Green, Height = 35, Width = 35 };
                    break;
                case SelectedShape.Rectangle:
                    shapeToRender = new Rectangle() { Fill = Brushes.Red, Height = 35, Width = 35, RadiusX = 10, RadiusY = 10 };
                    break;
                case SelectedShape.Line:
                    shapeToRender = new Line() { Fill = Brushes.Blue, StrokeThickness = 10, X1 = 0, X2 = 50, Y1 = 0, Y2 = 50 };
                    break;
                default:
                    return;
            }

            // Set top/left position to draw in the canvas.
            Canvas.SetLeft(shapeToRender, e.GetPosition(canvasDrawingArea).X);
            Canvas.SetTop(shapeToRender, e.GetPosition(canvasDrawingArea).Y);

            // Draw shape!
            canvasDrawingArea.Children.Add(shapeToRender);
        }
开发者ID:JamesPinkard,项目名称:WalkthroughSolutions,代码行数:27,代码来源:MainWindow.xaml.cs

示例12: OrganismVisual

        public OrganismVisual(Organism source, Ellipse organism, Polygon sight, PointCollection boundaries, TextBlock energy)
        {
            this.source = source;

            source.OnDeath += source_OnDeath;

            this.organism = organism;

            this.boundaries = boundaries;

            this.energy = energy;

            organism.Dispatcher.Invoke(new Action(() => organism.Fill = new SolidColorBrush(Colors.Red)));
            organism.Dispatcher.Invoke(new Action(() => organism.Height = source.getSize()));
            organism.Dispatcher.Invoke(new Action(() => organism.Width = source.getSize()));

            this.sight = sight;
            sight.Dispatcher.Invoke(new Action(() => sight.Fill = new SolidColorBrush(Color.FromArgb(50, 200, 200, 200))));
            sight.Dispatcher.Invoke(new Action(() => sight.Points = boundaries));

            energy.Dispatcher.Invoke(new Action(() => energy.Foreground = new SolidColorBrush(Colors.White)));
            energy.Dispatcher.Invoke(new Action(() => energy.HorizontalAlignment = HorizontalAlignment.Center));
            energy.Dispatcher.Invoke(new Action(() => energy.VerticalAlignment = VerticalAlignment.Center));
            energy.Dispatcher.Invoke(new Action(() => energy.TextAlignment = TextAlignment.Center));
            energy.Dispatcher.Invoke(new Action(() => energy.Height = 15));
            energy.Dispatcher.Invoke(new Action(() => energy.Width = 40));

            constructPointCollection();
        }
开发者ID:Spadar,项目名称:MachineLearning,代码行数:29,代码来源:OrganismVisual.cs

示例13: Flush

        public void Flush()
        {
            var thicknessAnimationUsingKeyFrames = new ThicknessAnimationUsingKeyFrames();
            thicknessAnimationUsingKeyFrames.KeyFrames = new ThicknessKeyFrameCollection();

            double delta = (Width - Height) / 2;

            var thicknessAnimation = new ThicknessAnimation()
            {
                From = new Thickness(delta, 0, delta, 0),
                To = new Thickness(delta - 500, -500, delta - 500, -500),
                Duration = new Duration(TimeSpan.FromSeconds(1)),
                AutoReverse = true
            };
            thicknessAnimation.Completed += new EventHandler(animation_Completed);

            _flushEllipse = new Ellipse()
            {
                Fill = new SolidColorBrush(Colors.LightBlue),
                Stroke = new SolidColorBrush(Colors.Orange),
                StrokeThickness = 5,
                Opacity = 0.5
            };

            Children.Add(_flushEllipse);
            _flushEllipse.BeginAnimation(Ellipse.MarginProperty, thicknessAnimation);
        }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:27,代码来源:ElementXDeviceView.xaml.cs

示例14: DrawRpmCanvas

        public void DrawRpmCanvas(List<int> rpms, List<float> speeds)
        {
            _cachedRpms = rpms;
            _cachedSpeeds = speeds;

            RpmCanvas.Children.Clear();
            if (rpms.Count == 0)
            {
                return;
            }
            int maxRpm = rpms.Max();
            float maxSpeed = speeds.Max();

            float yRatio = (CanvasHeight-40) / (float)maxRpm;
            float xRatio = (CanvasWidth-20) / (float)maxSpeed;

            for (int i = 0; i < rpms.Count; i++)
            {
                Ellipse e = new Ellipse();
                e.Height = 2;
                e.Width = 2;
                e.Fill = Brushes.Blue;

                Canvas.SetTop(e, (CanvasHeight-40) - rpms[i] * yRatio);
                Canvas.SetLeft(e, speeds[i] * xRatio);

                RpmCanvas.Children.Add(e);
            }
        }
开发者ID:icq4ever,项目名称:AssettoCorsaTelemetry,代码行数:29,代码来源:RpmViewModel.cs

示例15: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            ApplicationCommands.New.Text = "Новый";
            ApplicationCommands.Open.Text = "Открыть...";
            ApplicationCommands.Save.Text = "Сохранить как...";
            ApplicationCommands.Close.Text = "Выход";
            //ApplicationCommands.Close.InputGestures+= new InputGesture();

            for (int i = 0; i < count; i++)
            {
                Ellipse ellipse = new Ellipse();
                ellipse.Width = ellipse.Height = (100) * rand.NextDouble();
                ellipse.Fill = Brushes.Silver;
                ellipse.Stroke = Brushes.Black;
                ellipse.MouseDown += Ellipse_MouseDown;
                stack_panel.Children.Add(ellipse);
            }

            /*
            // Построение начальнойтриангуляции для полосы.
            double r = 100000;
            ellipses.Add(new Circle(r, 0, 400 + r));
            ellipses.Add(new Circle(r, -r, 0));
            ellipses.Add(new Circle(r, 0, 200 - r));
            triple = new Triple<Circle, DeloneCircle>(ellipses[0], ellipses[1], ellipses[2]);
            triple.CalculateDeloneCircle();
            vd = new VD<Circle, DeloneCircle>(triple, null);
            BuildTriples(vd.triples, visual_triples.Data as GeometryGroup, true);
            */

            //lv.DataContext = moves;
        }
开发者ID:Ring-r,项目名称:opt,代码行数:34,代码来源:MainWindow.xaml.cs


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