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


C# IGraphics.FillEllipse方法代码示例

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


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

示例1: Draw

 public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
 {
     int s2 = size/2;
     g.FillEllipse(brush, x - s2, y - s2, size, size);
     if (pen != null){
         g.DrawEllipse(pen, x - s2, y - s2, size, size);
     }
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:8,代码来源:SymbolTypeFilledCircle.cs

示例2: BotCircle

 public static void BotCircle(IGraphics graphics, double X, double Y, bool fill)
 {
     if (fill)
     {
         var transparentGreen = new SolidBrush(Color.FromArgb(30, 0, 0xFF, 0));
         graphics.FillEllipse(transparentGreen, (int)(X - 60), (int)(Y - 60), 120, 120);
     }
     graphics.DrawEllipse(Pens.Red, (int)(X - 50), (int)(Y - 50), 100, 100);
 }
开发者ID:KingLebron,项目名称:robocode,代码行数:9,代码来源:Paint.cs

示例3: DrawStartCap

		protected override void DrawStartCap(IGraphics g, bool onScreen, Style style)
		{
			linePen.Color = style.RelationshipColor;
			linePen.Width = style.RelationshipWidth;

			g.FillEllipse(Brushes.White, -Radius, 0, Diameter, Diameter);
			g.DrawEllipse(linePen, -Radius, 0, Diameter, Diameter);
			g.DrawLine(linePen, 0, Radius - CrossSize / 2, 0, Radius + CrossSize / 2);
			g.DrawLine(linePen, -CrossSize / 2, Radius, CrossSize / 2, Radius);
		}
开发者ID:BachelorEric,项目名称:ModelFirst,代码行数:10,代码来源:Nesting.cs

示例4: Draw

        /// <summary>
        /// Do all rendering associated with this <see cref="CurveItem"/> to the specified
        /// <see cref="Graphics"/> device.  This method is normally only
        /// called by the Draw method of the parent <see cref="CurveList"/>
        /// collection object.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="pos">The ordinal position of the current <see cref="Bar"/>
        /// curve.</param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        public override void Draw(IGraphics g, GraphPane pane, int pos, float scaleFactor)
        {
            RectangleF rect = GetDrawingRect(pane);

            g.FillEllipse(MakeBrush(), rect);
            g.DrawEllipse(MakePen(), rect);

            if(Image != null)
            {
                var left = rect.Left + rect.Width / 2.0 - Image.Width / 2.0;
                var top = rect.Top + rect.Height / 2.0 - Image.Height / 2.0;
                var tmpRect = new RectangleF((float)left, (float)top, Image.Width, Image.Height);
                Region clip = g.Clip;
                g.SetClip(tmpRect);
                g.DrawImageUnscaled(Image, Rectangle.Round(tmpRect));
                g.SetClip(clip, CombineMode.Replace);

            }
        }
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:41,代码来源:BubbleItem.cs

示例5: FillCircle

 /// <summary>
 /// Method that paints a filled circle at the specified coordinate (x,y) and given color. The
 /// circle will have a radius of 20 pixels (meaning that the diameter will be 40 pixels).
 /// </summary> 
 /// <param name="gfx">X coordinate.</param>
 /// <param name="x">X coordinate for the center of the circle.</param>
 /// <param name="y">Y coordinate for the center of the circle.</param>
 /// <param name="color">Color of the filled circle.</param>
 private void FillCircle(IGraphics gfx, double x, double y, Color color)
 {
     // Prepare brush
     Brush brush = new SolidBrush(color);
     // Paint a filled circle (oval) that has a radius of 20 pixels with a center at the input
     // coordinates.
     gfx.FillEllipse(brush, (float)x - 20, (float)y - 20, 40f, 40f);
 }
开发者ID:markthor,项目名称:robocode,代码行数:16,代码来源:BorderGuard.cs

示例6: BotDot

 public static void BotDot(IGraphics graphics, double X, double Y)
 {
     var opaqueYellow = new SolidBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0));
     graphics.FillEllipse(opaqueYellow, (int)(X - 2), (int)(Y - 2), 4, 4);
 }
开发者ID:KingLebron,项目名称:robocode,代码行数:5,代码来源:Paint.cs

示例7: Render

        private void Render(IGraphics ig)
        {
            string s = cbWhat.Text;

            if (s == "Clipping")
            {
                Pen pn = new Pen(Color.LightGray, 5);
                Pen pn2 = new Pen(Color.Yellow);

                ig.Clear(Color.Black);

                GraphicsContainer cnt = ig.BeginContainer();

                ig.SmoothingMode = SmoothingMode.HighQuality;

                ig.SetClip(new Rectangle(35,35,120,120));

                ig.DrawRectangle(pn, 5,5,45,70);
                ig.DrawRectangle(pn, 15,25,90,120);
                ig.DrawRectangle(pn, 50,30,100,170);
                ig.DrawRectangle(pn, 5,80,180,30);
                ig.DrawRectangle(pn, 75,10,40,160);

                ig.EndContainer(cnt);

                ig.DrawRectangle(pn2, 5,5,45,70);
                ig.DrawRectangle(pn2, 15,25,90,120);
                ig.DrawRectangle(pn2, 50,30,100,170);
                ig.DrawRectangle(pn2, 5,80,180,30);
                ig.DrawRectangle(pn2, 75,10,40,160);
            }
            else if (s == "Transforms")
            {

                ig.Clear(Color.Black);

                ig.RotateTransform(15);
                ig.DrawRectangle(new Pen(Color.Red,2), 260,80,50,40);
                ig.ResetTransform();
                ig.DrawRectangle(new Pen(Color.Red,2), 260,80,50,40);

                ig.TranslateTransform(15,-5);

                GraphicsContainer cnt = ig.BeginContainer();

                    ig.SmoothingMode = SmoothingMode.HighQuality;

                    ig.RotateTransform(5);
                    ig.FillEllipse(new SolidBrush(Color.Orange), 100,100,80,40);
                    ig.DrawRectangle(new Pen(Color.Orange,2), 60,80,40,40);

                    GraphicsContainer cnt2  = ig.BeginContainer();

                        ig.SmoothingMode = SmoothingMode.None;

                        ig.RotateTransform(5);
                        ig.ScaleTransform(1.1f, 1.2f);

                        ig.FillEllipse(new SolidBrush(Color.YellowGreen), 130,180,80,40);
                        ig.DrawRectangle(new Pen(Color.YellowGreen,2), 62,80,40,40);

                        GraphicsContainer cnt3  = ig.BeginContainer();

                            ig.SmoothingMode = SmoothingMode.HighQuality;

                            Matrix mm = new Matrix();
                            mm.Shear(0.3f, 0f);
                            ig.Transform = mm;

                            ig.FillEllipse(new SolidBrush(Color.Green), 180,120,80,40);
                            ig.DrawRectangle(new Pen(Color.Green,2), 62,84,40,40);

                        ig.EndContainer(cnt3);

                    ig.EndContainer(cnt2);

                    ig.FillEllipse(new SolidBrush(Color.Blue), 120,150,80,40);
                    ig.DrawRectangle(new Pen(Color.Blue,2), 64,80,40,40);

                ig.EndContainer(cnt);

                ig.FillEllipse(new SolidBrush(Color.Indigo), 80,210,80,40);
                ig.DrawRectangle(new Pen(Color.Indigo,2), 66,80,40,40);

                ig.DrawRectangle(new Pen(Color.White,2), 270,30,50,40);
                ig.ResetTransform();
                ig.DrawRectangle(new Pen(Color.White,2), 270,30,50,40);

            }
            else if (s == "Lines")
            {
                ig.SmoothingMode = SmoothingMode.AntiAlias;

                Pen ow = new Pen(Color.Purple, 12);
                ow.EndCap = LineCap.Round;
                ow.StartCap = LineCap.Round;
                ow.MiterLimit = 6f;
                ow.LineJoin = LineJoin.Miter;

                ig.SmoothingMode = SmoothingMode.None;
//.........这里部分代码省略.........
开发者ID:luizcorreia,项目名称:SvgNet,代码行数:101,代码来源:Form1.cs

示例8: OnPaint

 /// <summary>
 ///   Paint a red circle around our PaintingRobot
 /// </summary>
 public override void OnPaint(IGraphics graphics)
 {
     var transparentGreen = new SolidBrush(Color.FromArgb(30, 0, 0xFF, 0));
     graphics.FillEllipse(transparentGreen, (int) (X - 60), (int) (Y - 60), 120, 120);
     graphics.DrawEllipse(Pens.Red, (int) (X - 50), (int) (Y - 50), 100, 100);
 }
开发者ID:khangnguyen,项目名称:robocode,代码行数:9,代码来源:PaintingRobot.cs

示例9: Draw

        /// <summary>
        /// Render this object to the specified <see cref="Graphics"/> device.
        /// </summary>
        /// <remarks>
        /// This method is normally only called by the Draw method
        /// of the parent <see cref="GraphObjList"/> collection object.
        /// </remarks>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="PaneBase"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        public override void Draw( IGraphics g, PaneBase pane, float scaleFactor )
        {
            // Convert the arrow coordinates from the user coordinate system
            // to the screen coordinate system
            RectangleF pixRect = this.Location.TransformRect( pane );

            if (	Math.Abs( pixRect.Left ) < 100000 &&
                    Math.Abs( pixRect.Top ) < 100000 &&
                    Math.Abs( pixRect.Right ) < 100000 &&
                    Math.Abs( pixRect.Bottom ) < 100000 )
            {
                if ( _fill.IsVisible )
                    using ( Brush brush = _fill.MakeBrush( pixRect ) )
                        g.FillEllipse( brush, pixRect );

                if ( _border.IsVisible )
                    using ( Pen pen = _border.GetPen( pane, scaleFactor ) )
                        g.DrawEllipse( pen, pixRect );
            }
        }
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:41,代码来源:EllipseObj.cs

示例10: DrawControlPoint

        public static void DrawControlPoint(IGraphics g, Coordinates loc, Color color, string label, ContentAlignment align, ControlPointStyle style, bool drawTextBox, WorldTransform wt)
        {
            // figure out the size the control box needs to be in world coordinates to make it
            // show up as appropriate in view coordinates

            // invert the scale
            float scaled_size = 0;
            if (style == ControlPointStyle.LargeBox || style == ControlPointStyle.LargeCircle || style == ControlPointStyle.LargeX) {
                scaled_size = cp_large_size / wt.Scale;
            }
            else {
                scaled_size = cp_small_size / wt.Scale;
            }

            float scaled_offset = 1 / wt.Scale;

            // assume that the world transform is currently applied correctly to the graphics
            RectangleF rect = new RectangleF(-scaled_size / 2, -scaled_size / 2, scaled_size, scaled_size);
            rect.Offset(Utility.ToPointF(loc));
            if (style == ControlPointStyle.LargeBox) {
                g.FillRectangle(Color.White, rect);

                // shrink the rect down a little (nominally 1 pixel)
                rect.Inflate(-scaled_offset, -scaled_offset);
                g.FillRectangle(color, rect);
            }
            else if (style == ControlPointStyle.LargeCircle) {
                g.FillEllipse(Color.White, rect);

                // shrink the rect down a little (nominally 1 pixel)
                rect.Inflate(-scaled_offset, -scaled_offset);
                g.FillEllipse(color, rect);
            }
            else if (style == ControlPointStyle.LargeX) {
                using (IPen p = g.CreatePen()) {
                    p.Width = 3/wt.Scale;
                    p.Color = Color.White;
                    g.DrawLine(p, new PointF(rect.Left, rect.Top), new PointF(rect.Right, rect.Bottom));
                    g.DrawLine(p, new PointF(rect.Left, rect.Bottom), new PointF(rect.Right, rect.Top));

                    p.Width = scaled_offset;
                    p.Color = color;
                    g.DrawLine(p, new PointF(rect.Left, rect.Top), new PointF(rect.Right, rect.Bottom));
                    g.DrawLine(p, new PointF(rect.Left, rect.Bottom), new PointF(rect.Right, rect.Top));
                }
            }
            else if (style == ControlPointStyle.SmallBox) {
                g.FillRectangle(color, rect);
            }
            else if (style == ControlPointStyle.SmallCircle) {
                g.FillEllipse(color, rect);
            }
            else if (style == ControlPointStyle.SmallX) {
                using (IPen p = g.CreatePen()) {
                    p.Width = 3/wt.Scale;
                    p.Color = color;
                    g.DrawLine(p, new PointF(rect.Left, rect.Top), new PointF(rect.Right, rect.Bottom));
                    g.DrawLine(p, new PointF(rect.Left, rect.Bottom), new PointF(rect.Right, rect.Top));
                }
            }

            if (!string.IsNullOrEmpty(label)) {
                SizeF strSize = g.MeasureString(label, label_font);
                float x = 0, y = 0;

                if (align == ContentAlignment.BottomRight || align == ContentAlignment.MiddleRight || align == ContentAlignment.TopRight) {
                    x = (float)loc.X + cp_label_space / wt.Scale;
                }
                else if (align == ContentAlignment.BottomCenter || align == ContentAlignment.MiddleCenter || align == ContentAlignment.TopCenter) {
                    x = (float)loc.X - strSize.Width / (2 * wt.Scale);
                }
                else if (align == ContentAlignment.BottomLeft || align == ContentAlignment.MiddleLeft || align == ContentAlignment.TopLeft) {
                    x = (float)loc.X - (strSize.Width + cp_label_space) / wt.Scale;
                }

                if (align == ContentAlignment.BottomCenter || align == ContentAlignment.BottomLeft || align == ContentAlignment.BottomRight) {
                    y = (float)loc.Y - cp_label_space / wt.Scale;
                }
                else if (align == ContentAlignment.MiddleCenter || align == ContentAlignment.MiddleLeft || align == ContentAlignment.MiddleRight) {
                    y = (float)loc.Y + strSize.Height / (2 * wt.Scale);
                }
                else if (align == ContentAlignment.TopCenter || align == ContentAlignment.TopLeft || align == ContentAlignment.TopRight) {
                    y = (float)loc.Y + (strSize.Height + cp_label_space) / wt.Scale;
                }

                PointF text_loc = new PointF(x, y);

                if (drawTextBox) {
                    RectangleF text_rect = new RectangleF(text_loc.X - 4/wt.Scale, text_loc.Y - 4/wt.Scale, strSize.Width/wt.Scale, strSize.Height/wt.Scale);
                    g.FillRectangle(Color.FromArgb(127, Color.White), text_rect);
                }

                g.DrawString(label, label_font, color, text_loc);
            }
        }
开发者ID:anand-ajmera,项目名称:cornell-urban-challenge,代码行数:95,代码来源:DrawingUtility.cs

示例11: DrawPoint

        public void DrawPoint(IGraphics g, IPoint point, Brush b, float size, PointF offset, Map map)
        {
            if (point == null)
                return;

            var pp = Transform.WorldtoMap(point.Coordinate, map);
            //var startingTransform = g.Transform;

            float width = size;
            float height = size;

            g.FillEllipse(b,
                (int)(pp.X - width / 2 + offset.X), (int)(pp.Y - height / 2 + offset.Y),
                (int)width, (int)height);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:15,代码来源:VectorRenderer.cs

示例12: DrawLabel

        public void DrawLabel(IGraphics g, PointF labelPoint, PointF offset, Font font, Color forecolor,
                                     Brush backcolor, Pen halo, float rotation, string text, Map map,
                                     LabelStyle.HorizontalAlignmentEnum alignment = LabelStyle.HorizontalAlignmentEnum.Left,
                                     PointF? rotationPoint = null)
        {
            //Calculate the size of the text
            var labelSize = RendererHelper.SizeOfString(g, text, font);

            //Add label offset
            labelPoint.X += offset.X;
            labelPoint.Y += offset.Y;

            //Translate alignment to stringalignment
            StringAlignment salign;
            switch (alignment)
            {
                case LabelStyle.HorizontalAlignmentEnum.Left:
                    salign = StringAlignment.Near;
                    break;
                case LabelStyle.HorizontalAlignmentEnum.Center:
                    salign = StringAlignment.Center;
                    break;
                default:
                    salign = StringAlignment.Far;
                    break;
            }

            if (rotation != 0 && !float.IsNaN(rotation))
            {
                rotationPoint = rotationPoint ?? labelPoint;

                PointF pt = rotationPoint.Value;
                g.FillEllipse(Brushes.LawnGreen, (int)(pt.X - 1), (int)(pt.Y - 1), 2, 2);

                var t = g.Transform.Clone();
                g.TranslateTransform(pt.X, pt.Y);
                g.RotateTransform(rotation);
                //g.TranslateTransform(-labelSize.Width/2, -labelSize.Height/2);

                labelPoint = new PointF(labelPoint.X - pt.X,
                                        labelPoint.Y - pt.Y);

                //labelSize = new SizeF(labelSize.Width*0.74f + 1f, labelSize.Height*0.74f);
                if (backcolor != null && backcolor != Brushes.Transparent)
                    g.FillRectangle(backcolor,
                        (int)labelPoint.X, (int)labelPoint.Y,
                        (int)labelSize.Width, (int)labelSize.Height);

                var path = new GraphicsPath();
                path.AddString(text, font.FontFamily, (int)font.Style, font.Size,
                               new RectangleF(labelPoint, labelSize) /* labelPoint*/,
                               new StringFormat { Alignment = salign } /*null*/);
                if (halo != null)
                    g.DrawPath(halo, path);

                g.FillPath(new SolidBrush(forecolor), path);
                //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), 0, 0);        
                g.Transform = t;
            }
            else
            {
                if (backcolor != null && backcolor != Brushes.Transparent)
                    g.FillRectangle(backcolor,
                        (int)labelPoint.X, (int)labelPoint.Y,
                        (int)labelSize.Width, (int)labelSize.Height);

                var path = new GraphicsPath();
                path.AddString(text, font.FontFamily, (int)font.Style, font.Size,
                               new RectangleF(labelPoint, labelSize) /* labelPoint*/,
                               new StringFormat { Alignment = salign } /*null*/);
                if (halo != null)
                    g.DrawPath(halo, path);
                g.FillPath(new SolidBrush(forecolor), path);
                //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), LabelPoint.X, LabelPoint.Y);
            }
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:76,代码来源:VectorRenderer.cs

示例13: PaintRoundButton

 public static void PaintRoundButton(IGraphics g, Brush2 b, Pen2 w, int x, int y, int size, bool selected)
 {
     if (selected){
         g.FillEllipse(Brushes2.Red, x - 1, y - 1, size + 2, size + 2);
     }
     g.FillEllipse(b, x, y, size, size);
     g.DrawEllipse(w, x + 2, y + 2, size - 4, size - 4);
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:8,代码来源:GraphUtil.cs


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