• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Shapes.Ellipse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnRender

        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            Random r = new Random();
            Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize);
            Point stPt = new Point(adornedElementRect.X, adornedElementRect.Y);
            for (int x = 0; x < Number; x++)
            {

                Ellipse e = new Ellipse();
                e.Width = 4;

                Brush b = new SolidColorBrush(new Color() { R =(byte) r.Next(0,255), G =(byte) r.Next(0,255),B =(byte) r.Next(0,255) });

                Pen p = new Pen(Brushes.Black,1);
                int Rad = 3 ;
                drawingContext.DrawEllipse(b, p, stPt, Rad, Rad);
                stPt.X += (Rad * 2) + 1;
                if (stPt.X > adornedElementRect.Width)
                {
                    stPt.X = 3;
                    stPt.Y += 3;
                }

            }

            // Some arbitrary drawing implements.
        }
开发者ID:sabarn01,项目名称:DrawSomeDots,代码行数:27,代码来源:AdornWithDots.cs


示例17: Update

		void Update(CallTreeNodeViewModel item)
		{
			Debug.WriteLine("RingDiagram.Update: new root = " + item);
			
			task.Cancel();
			
			Debug.WriteLine("hierarchyStack count: " + hierarchyStack.Count);
			
			while (hierarchyStack.Count > 0 && !hierarchyStack.Peek().IsAncestorOf(item)) {
				hierarchyStack.Pop();
			}

			Debug.Assert(hierarchyStack.Count == 0 || hierarchyStack.Peek().IsAncestorOf(item));

			Children.Clear();
			
			if (item == null)
				return;
			
			List<Shape> newItems = new List<Shape>();
			
			Ellipse ell = new Ellipse();
			ell.Width = 40;
			ell.Height = 40;
			ell.VerticalAlignment = VerticalAlignment.Center;
			ell.HorizontalAlignment = HorizontalAlignment.Center;
			ell.Fill = Brushes.Gray;
			ell.Stroke = Brushes.Black;
			ell.ToolTip = item.CreateToolTip(Translation);
			ell.Tag = item;

			ell.MouseLeftButtonDown += (sender, e) =>
			{
				if (hierarchyStack.Count > 1 && hierarchyStack.Peek().Level > 1) {
					var oldItem = hierarchyStack.Pop();
					SelectedRoot = hierarchyStack.Peek();
					SelectedRoot.IsSelected = true;
					SelectedRoot.IsExpanded = true;
					oldItem.IsSelected = false;
				}
			};
			
			if (hierarchyStack.Count == 0 || hierarchyStack.Peek() != item)
				hierarchyStack.Push(item);
			
			List<PiePieceDescriptor> pieces = new List<PiePieceDescriptor>();
			
			task.Execute(
				() => {
					if (item.CpuCyclesSpent > 0)
						CreateTree(pieces, item, 0, item.CpuCyclesSpent, 0);
				},
				() => {
					Children.Add(ell);
					Children.AddRange(pieces.Select(p => CreatePiePiece(p.Radius, p.WedgeAngle, p.RotationAngle, p.Level, p.Node)));
					item.BringIntoView();
				},
				delegate { }
			);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:60,代码来源:RingDiagramControl.cs


示例18: Plot

        void Plot(JointType centerID, JointType baseID, JointCollection joints)
        {
            float centerX;
            float centerY;

            GetCoordinates(centerID, joints, out centerX, out centerY);

            float baseX;
            float baseY;

            GetCoordinates(baseID, joints, out baseX, out baseY);

            double diameter = Math.Abs(baseY - centerY);

            Ellipse ellipse = new Ellipse
            {
                Width = diameter,
                Height = diameter,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                StrokeThickness = 4.0,
                Stroke = new SolidColorBrush(Colors.Green),
                StrokeLineJoin = PenLineJoin.Round
            };

            Canvas.SetLeft(ellipse, centerX - ellipse.Width / 2);
            Canvas.SetTop(ellipse, centerY - ellipse.Height / 2);

            rootCanvas.Children.Add(ellipse);
        }
开发者ID:Hitchhikrr,项目名称:harley,代码行数:30,代码来源:SkeletonDisplayManager.cs


示例19: Window_Loaded

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < N; i++)
            {
                this.grid.RowDefinitions.Add(new RowDefinition());
            }
            for (int i = 0; i < M; i++)
            {
                this.grid.ColumnDefinitions.Add(new ColumnDefinition());
            }
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < M; j++)
                {
                    Ellipse ellipse = new Ellipse();
                    ellipse.Fill = Brushes.AliceBlue;
                    ellipse.Stroke = Brushes.Black;
                    ellipse.Margin = new Thickness(5);
                    ellipse.MouseDown += ellipse_MouseDown;

                    Grid.SetRow(ellipse, i);
                    Grid.SetColumn(ellipse, j);
                    this.grid.Children.Add(ellipse);
                }
            }
        }
开发者ID:davidbedok,项目名称:oeprogvep,代码行数:26,代码来源:MainWindow.xaml.cs


示例20: Star

        public Star()
        {
            starColor = foregroundBrush;

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

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

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

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

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

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

            starCanvas.MouseLeftButtonDown += SetSelection;
            starCanvas.MouseRightButtonDown +=TargetSelection;

            starCanvas.MouseEnter += ShowInfoSelection;
            starCanvas.MouseLeave += HideInfoSelection;
        }
开发者ID:saturnineNL,项目名称:GMV,代码行数:29,代码来源:Star.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Shapes.Line类代码示例发布时间:2022-05-26
下一篇:
C# Navigation.RequestNavigateEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap