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


C# Graphics.DrawEllipse方法代码示例

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


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

示例1: insertLights

        void insertLights(Graphics g)
        {
            return;

            uint mapSize = 64 * 17;
            float realSize = 64 * Utils.Metrics.Tilesize;
            float step = realSize / mapSize;
            Pen innerPen = new Pen(Color.Orange, 4);
            Pen outerPen = new Pen(Color.Red, 4);

            foreach (var dbl in DBC.DBCStores.Light.Records)
            {
                if (dbl.MapID == Game.GameManager.WorldManager.MapID)
                {
                    float x = dbl.x / 36;
                    float y = dbl.z / 36;
                    x /= step;
                    y /= step;
                    float iRadius = dbl.falloff / 36;
                    iRadius /= step;
                    float oRadius = dbl.falloffEnd / 36;
                    oRadius /= step;

                    g.DrawEllipse(innerPen, x - iRadius, y - iRadius, 2 * iRadius, 2 * iRadius);
                    g.DrawEllipse(outerPen, x - oRadius, y - oRadius, 2 * oRadius, 2 * oRadius);
                }
            }
        }
开发者ID:remixod,项目名称:sharpwow,代码行数:28,代码来源:LightEditorTab.cs

示例2: paint

        }//end constructor

        //call the paint method
        public override void paint (Graphics graphics)
        {
            try
            {
                //save the old value of the circle position
                previousLeftPosition = leftPosition;
                previousTopPosition = topPosition;

                //put this thread to sleep
                Thread.Sleep(speed);

                //lock thread to prevent thread from running back on itself
                lock (typeof(Thread))
                {
                    leftPosition = leftPosition + base.directionX;
                    topPosition = topPosition + base.directionY;
                    base.CheckCoordinates();

                    //grouped the drawing functions together like this to slightly reduce flickering
                    graphics.DrawEllipse(new System.Drawing.Pen(Color.White), previousLeftPosition, previousTopPosition, width, height);
                    graphics.DrawEllipse(new System.Drawing.Pen(shapeColor), leftPosition, topPosition, width, height);
                }
            }
            catch
            {
                //force the thread to end, but only after removing the shape from the screen
                graphics.Clear(Color.White);
                Thread.CurrentThread.Abort();
            }
        }//end paint
开发者ID:CourtneyBowden,项目名称:AdvancedCSharp.hw3.Graphics,代码行数:33,代码来源:Circle.cs

示例3: DrawLineBetweenJoints

 private void DrawLineBetweenJoints(Graphics g, Skeleton skel, SkeletonJoint.JointType j1, SkeletonJoint.JointType j2)
 {
     try
     {
         if (skel.State == Skeleton.SkeletonState.TRACKED)
         {
             SkeletonJoint joint1 = skel.getJoint(j1);
             SkeletonJoint joint2 = skel.getJoint(j2);
             if (joint1.Position.Z > 0 && joint2.Position.Z > 0)
             {
                 Point j1PosEllipse = new Point();
                 Point j2PosEllipse = new Point();
                 NiTEWrapper.PointF j1PosLine = uTracker.ConvertJointCoordinatesToDepth(joint1.Position);
                 NiTEWrapper.PointF j2PosLine = uTracker.ConvertJointCoordinatesToDepth(joint2.Position);
                 j1PosEllipse.X = (int)j1PosLine.X - 5;
                 j1PosEllipse.Y = (int)j1PosLine.Y - 5;
                 j2PosEllipse.X = (int)j2PosLine.X - 5;
                 j2PosEllipse.Y = (int)j2PosLine.Y - 5;
                 j1PosLine.X -= 2;
                 j1PosLine.Y -= 2;
                 j2PosLine.X -= 2;
                 j2PosLine.Y -= 2;
                 g.DrawLine(new Pen(Brushes.White, 3), j1PosLine.X, j1PosLine.Y, j2PosLine.X, j2PosLine.Y);
                 g.DrawEllipse(new Pen(Brushes.White, 5), new Rectangle(j1PosEllipse, new System.Drawing.Size(5, 5)));
                 g.DrawEllipse(new Pen(Brushes.White, 5), new Rectangle(j2PosEllipse, new System.Drawing.Size(5, 5)));
             }
         }
     }
     catch (Exception) { }
 }
开发者ID:kirurobo,项目名称:NiWrapperMono,代码行数:30,代码来源:frm_Main.cs

示例4: Draw

 public void Draw(Graphics aGraphics)
 {
     float s = Size * 0.27f;
     aGraphics.DrawRectangle(Pens.Purple, Center.X - s, Center.Y - s, s * 2, s * 2);
     aGraphics.DrawEllipse(Pens.Purple, Center.X - 10, Center.Y - 10, 20, 20);
     aGraphics.DrawEllipse(Pens.Purple, Center.X - (Size * 0.5f), Center.Y - (Size * 0.5f), Size, Size);
 }
开发者ID:tvandijck,项目名称:WingSuitJudge,代码行数:7,代码来源:GridBound.cs

示例5: Render

        internal override void Render(Graphics graphics, SizeF minimumSize, PointF location)
        {
            var size = Measure(graphics);
            size.Width = Math.Max(minimumSize.Width, size.Width);
            size.Height = Math.Max(minimumSize.Height, size.Height);

            Brush incomingSignalColor = Brushes.LightSteelBlue;
            Brush ownSignalColor = Brushes.LightSteelBlue;

            if (m_signal.IsIncomingRised())
            {
                incomingSignalColor = Brushes.LimeGreen;
            }

            if (m_signal.IsDropped())
            {
                ownSignalColor = Brushes.Tomato;
            }
            if (m_signal.IsRised())
            {
                ownSignalColor = Brushes.LimeGreen;
            }

            graphics.FillEllipse(incomingSignalColor, location.X + SIGNAL_OFFSET, location.Y + SIGNAL_OFFSET, SIGNAL_SIZE, SIGNAL_SIZE);
            graphics.DrawEllipse(Pens.DimGray, location.X + SIGNAL_OFFSET, location.Y + SIGNAL_OFFSET, SIGNAL_SIZE, SIGNAL_SIZE);

            graphics.FillEllipse(ownSignalColor, location.X + 2 * SIGNAL_OFFSET + SIGNAL_SIZE, location.Y + SIGNAL_OFFSET, SIGNAL_SIZE, SIGNAL_SIZE);
            graphics.DrawEllipse(Pens.DimGray, location.X + 2 * SIGNAL_OFFSET + SIGNAL_SIZE, location.Y + SIGNAL_OFFSET, SIGNAL_SIZE, SIGNAL_SIZE);

            graphics.DrawString(this.Text, SystemFonts.MenuFont, Brushes.Black, new RectangleF(location, size), GraphConstants.RightTextStringFormat);
        }
开发者ID:sschocke,项目名称:BrainSimulator,代码行数:31,代码来源:MySignalItem.cs

示例6: drawnShap

        public override void drawnShap(Graphics pe)
        {
            Brush CurrentBrush = initBrush();
            if (this.State.Shift1 == true)
            {
                calcShift();

                findSecondPointWhenShift();

                pe.DrawEllipse(new Pen(State.CurrentColor, State.LineWidth), State.StartPoint.X, State.StartPoint.Y, State.Width1, State.Width1);
                if (State.IsBrushFill == true)
                {
                    pe.FillEllipse(CurrentBrush, State.StartPoint.X, State.StartPoint.Y, State.Width1, State.Width1);
                }
            }
            else
            {
                calcHeightWidth();
                pe.DrawEllipse(new Pen(State.CurrentColor, State.LineWidth), State.StartPoint.X, State.StartPoint.Y, State.Width1, State.Height1);

                if (State.IsBrushFill == true)
                {
                    pe.FillEllipse(CurrentBrush, State.StartPoint.X, State.StartPoint.Y, State.Width1, State.Height1);
                }
            }


        }
开发者ID:uynguyen,项目名称:MyCollaborativePainting,代码行数:28,代码来源:MyEllipse.cs

示例7: DrawMagnetControl

 private void DrawMagnetControl(Graphics g, double a)
 {
     g.DrawEllipse(Pens.Red, 200, 200, 100, 100);
     float x = (float)(100 * Math.Cos(a));
     float y = (float)(100 * Math.Sin(a));
     g.DrawEllipse(Pens.Black, x, y, 1, 1);
 }
开发者ID:KlimZavadski,项目名称:QuadCopter,代码行数:7,代码来源:RemoteControlSystem.cs

示例8: backward

        public void backward(Graphics g, string textBoxrstartx1, string textBoxrstarty1, string textBoxrtravel, string textBoxrangle, string textBoxrendx, string textBoxrendy)
        {
            IncializePic(g);

            //Draw Robot Angle
            x1 = double.Parse(textBoxrstartx1);
            y1 = double.Parse(textBoxrstarty1);
            x2 = (double)((Convert.ToDouble(textBoxrtravel)) * Math.Cos((Math.PI / 180) * (Convert.ToDouble(textBoxrangle))));
            y2 = (double)((Convert.ToDouble(textBoxrtravel)) * Math.Sin((Math.PI / 180) * (Convert.ToDouble(textBoxrangle))));
            x3 = (double)(length * Math.Cos((Math.PI / 180) * (Convert.ToDouble(textBoxrangle))));
            y3 = (double)(length * Math.Sin((Math.PI / 180) * (Convert.ToDouble(textBoxrangle))));

            //Old Position
            g.DrawLine(p3, (float)x1, (float)y1, (float)(x1 + x3), (float)(y1 + y3));
            //Old Direction
            g.DrawEllipse(p3, (float)x1 - 5, (float)y1 - 5, 10, 10);

            //Draw Direction
            g.DrawLine(p1, (float)(x1 - x2), (float)(y1 - y2), (float)(x1 - x2 + x3), (float)(y1 - y2 + y3));
            //Draw Robot Position /Start Point Incremented
            g.DrawEllipse(p1, (float)(x1 - x2) - 5, (float)(y1 - y2) - 5, 10, 10);

            //Draw End Point
            g.DrawEllipse(p2, (float)double.Parse(textBoxrendx) - 5, (float)double.Parse(textBoxrendy) - 5, 10, 10);
        }
开发者ID:salih18200,项目名称:orcs,代码行数:25,代码来源:kinematics.cs

示例9: draw

        //default robot draw method
        public virtual void draw(Graphics g, CoordinateFrame frame)
        {
            Point upperleft = frame.to_display((float)(circle.p.x - radius),(float)(circle.p.y- radius));
            int size = (int)((radius*2)/frame.scale);
            Rectangle r = new Rectangle(upperleft.X,upperleft.Y,size,size);
            if (disabled)
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            else if (collide_last)
                g.DrawEllipse(EngineUtilities.RedPen, r);
            else if (corrected)
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            else
                g.DrawEllipse(EngineUtilities.BluePen, r);
            int sensCount=0;
            foreach(ISensor sensor in sensors)
            {
                sensor.draw(g,frame);
            }

            if(display_debug)
            foreach(ISensor sensor in sensors)
            {
                if(draw_sensors) {
                double val = sensor.get_value();
                if(val<0.0) val=0.0;
                if(val>1.0) val=1.0;
                Color col = Color.FromArgb((int)(val*255),0,0); //(int)(val*255),(int)(val*255));
                SolidBrush newpen = new SolidBrush(col);
                g.FillRectangle(newpen,sensCount*40,500+30*id,40,30);
                sensCount+=1;
                }
            }
        }
开发者ID:jtglaze,项目名称:IndependentWork2013,代码行数:34,代码来源:Robot.cs

示例10: Draw

        /// <summary>
        /// Draw method.
        /// </summary>
        /// <param name="g">Graphics context.</param>
        public override void Draw(Graphics g)
        {
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            g.FillEllipse(LcogBrushes.Planet, this.X, this.Y, 2, 2);

            if (this.Faction == null)
            {
            }
            else if (this.Faction == Client.Instance.Player.Faction)
            {
                g.DrawEllipse(LcogPens.OwnPlanet, this.X - 2, this.Y - 2, 6, 6);
            }
            else if (this.Faction != Client.Instance.Player.Faction && this.Faction.Relations == "neutral")
            {
                g.DrawEllipse(LcogPens.NeutralPlanet, this.X - 2, this.Y - 2, 6, 6);
            }
            else
            {
                g.DrawEllipse(LcogPens.HostilePlanet, this.X - 2, this.Y - 2, 6, 6);
            }

            if (this == Client.Instance.Selected)
            {
                g.DrawEllipse(LcogPens.Selected, this.X - 2, this.Y - 2, 6, 6);
            }
        }
开发者ID:sal1n,项目名称:lcog-client,代码行数:31,代码来源:Planet.cs

示例11: Draw

        public override void Draw(Graphics g, Pen p, Brush b)
        {
            if (g == null)
            {
                throw new ShapeException("Graphics is null");
            }
            else if (g == null && p == null)
            {
                throw new ShapeException("Pen && Brush is null");
            }

            //Нарисовать элипс необходимого типа

            if (this.IsFill)
            {
                if (b == null) { throw new ShapeException("Brash is null"); }
                g.FillEllipse(b, new Rectangle(BeginPoint.X, BeginPoint.Y, EndPoint.X - BeginPoint.X, EndPoint.Y - BeginPoint.Y));
                if (p != null)
                {
                    g.DrawEllipse(p, new Rectangle(BeginPoint.X, BeginPoint.Y, EndPoint.X - BeginPoint.X, EndPoint.Y - BeginPoint.Y));
                }
            }
            else
            {
                if (p == null) { throw new ShapeException("Pen is null"); }
                g.DrawEllipse(p, new Rectangle(BeginPoint.X, BeginPoint.Y, EndPoint.X - BeginPoint.X, EndPoint.Y - BeginPoint.Y));
            }
        }
开发者ID:Dr1N,项目名称:PaintNET,代码行数:28,代码来源:Shape.cs

示例12: CreatePersonFat

 public static void CreatePersonFat(Graphics g, Pen p)
 {
     g.DrawEllipse(p, 50, 20, 30, 30); //head
     g.DrawEllipse(p, 45, 50, 40, 50); //body
     g.DrawLine(p, 50, 50, 30, 100); //left arm
     g.DrawLine(p, 80, 50, 100, 100); //right arm
     g.DrawLine(p, 60, 100, 45, 150); //left leg
     g.DrawLine(p, 70, 100, 85, 150); //right leg
 }
开发者ID:ningboliuwei,项目名称:Course_DesignPatterns,代码行数:9,代码来源:PersonBuilder.cs

示例13: draw

        public override void draw(Graphics g, int width, int height)
        {
            setRectangle(width, height);

            if (m_Rectangle.X > width * 0.4 && m_Rectangle.X < width * 0.6)
                g.DrawEllipse(System.Drawing.Pens.Red, m_Rectangle);
            else
                g.DrawEllipse(m_Pen, m_Rectangle);
        }
开发者ID:sachindeshpande,项目名称:TRapperProject,代码行数:9,代码来源:DrawWidget.cs

示例14: Draw

 public override void Draw(Graphics g, Rectangle clip)
 {
     var stoneWidth = clip.Width / 3;
     int stoneHeight = clip.Height / 3;
     if(Stones >= 1) g.DrawEllipse(_pen, new Rectangle(clip.X + 1, clip.Y + 1, stoneWidth, stoneHeight));
     if(Stones >= 2) g.DrawEllipse(_pen, new Rectangle(clip.Right - stoneWidth - 1, clip.Y + 1, stoneWidth, stoneHeight));
     if(Stones >= 3) g.DrawEllipse(_pen, new Rectangle(clip.X + 1, clip.Bottom - stoneHeight - 1, stoneWidth, stoneHeight));
     if(Stones >= 4) g.DrawEllipse(_pen, new Rectangle(clip.Right - stoneWidth - 1, clip.Bottom - stoneHeight - 1, stoneWidth, stoneHeight));
 }
开发者ID:kiple,项目名称:mouselab,代码行数:9,代码来源:UglyFreeCell.cs

示例15: Draw

 public override void Draw(Graphics g)
 {
     Pen pen = new Pen(Brushes.Black,3);
        UpdateBounds();
        g.FillEllipse(Brushes.Red, X,Y, 10, 10);
        g.DrawEllipse(pen, X - 3, Y - 3, 13, 13);
        g.FillPie(Brushes.White,X,Y, 10, 10, 0, 180);
        g.DrawEllipse(pen, X + 3, Y + 3, 2, 2);
     Y = Y - BallInterval;
 }
开发者ID:KristijanLaskovski,项目名称:Pokemon2014,代码行数:10,代码来源:Pokeball.cs


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