locked
draw a circle and fill the red color and text RRS feed

  • Question

  • User-425599523 posted

    Hi I want to draw a red background small circle and include 10% off inside in the circle.. How can I do it.. thanks

    Saturday, July 27, 2013 3:35 AM

All replies

  • User516094431 posted

    Check below links, Here you will find your problem solution:


    http://asp-net-example.blogspot.ae/2012/04/how-to-draw-transparent-ellipse-circle.html

    http://forums.asp.net/t/1582866.aspx/1

    Saturday, July 27, 2013 3:40 AM
  • User-425599523 posted

    hi..

    Sorry I did not try, looks like the code, will only draw a circle, but I need some text as well in the circle.. Thanks

    Monday, July 29, 2013 1:22 PM
  • User-460739707 posted

    Hi,

    About drawing a circle and fill text within it in asp.net, you could try below way.

    Firstly, you could draw a circle in a pircture and save the pricture in the server side, then fill some text in the pircture.

    About Drawing circle in asp.net, you could refer to:

    http://asp-net-example.blogspot.in/2012/04/how-to-draw-filled-circle-ellipse-with.html

    http://usingaspdotnet.blogspot.in/2012/01/draw-circle-in-aspnet.html

    Writing text in a pircture:

    http://www.aspjpeg.com/manual_05.html

    Regards

     

    Wednesday, July 31, 2013 10:22 PM
  • User71929859 posted

    Hello,

    but I need some text as well in the circle

    Think about HTML5 Canvas.

    Sunday, August 4, 2013 11:30 AM
  • User-1038772411 posted

    Hello bsarahim,

    We wrote code related to the web form application. We attached below code for .aspx page and .cshtml page.

    .aspx page

     <asp:Image ID="Image1" runat="server" />

    .aspx.cs page

                Bitmap bmp = new Bitmap(250, 250);
                Graphics g = Graphics.FromImage(bmp);
                int heightOfRectangle = 200;
                int widthOfRectangle = heightOfRectangle;
                int xPosition = 25;
                int yPosition = 25;
                Rectangle rect = new Rectangle(xPosition, yPosition, widthOfRectangle, heightOfRectangle);                 
                Brush drawingPen = new SolidBrush(Color.Red);            
                g.FillEllipse(drawingPen, rect);
                rect = new Rectangle(heightOfRectangle-115, heightOfRectangle-90, widthOfRectangle-50, heightOfRectangle-150);
                g.DrawString("Your Text", new Font("Times", 15), Brushes.Black, rect);            
                string path = Server.MapPath("~/Image/DrawTransparentEllipse.jpg");
                bmp.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);
                Image1.ImageUrl = "~/Image/DrawTransparentEllipse.jpg";
                g.Dispose();
                bmp.Dispose();

    Using the above code you can set your text and color.

    If you want still any help please inform us.

    Thanks.

    Wednesday, December 25, 2019 1:24 PM