Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7705433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:51:51+00:00 2026-05-31T23:51:51+00:00

I draw the ellipse with the code as shown below. How can I make

  • 0

I draw the ellipse with the code as shown below. How can I make the height of the red color is inside the ellipse can be changed for example from 0% -100%. If 0% the meanings the level of red height is empty. If 50% the meanings height level of the red color is half of the ellipse. If 100% the meanings height level of the red color is full. Thank You.

    private void panel1_Paint(object sender, PaintEventArgs e)
    {
        Rectangle r1= new Rectangle(10, 130, 60, 60);

        // Create solid brush.
        SolidBrush redBrush = new SolidBrush(Color.Red);

        // Create location and size of ellipse.
        float x = 20F;
        float y = 20F;
        float width = 80.0F;
        float height = 200.0F;

        // Fill ellipse on screen.
        e.Graphics.FillEllipse(redBrush, x, y, width, height);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:51:52+00:00Added an answer on May 31, 2026 at 11:51 pm

    Please, try the following code:

    void panel1_Paint(object sender, PaintEventArgs e)
        float percent = 0.75f;
        RectangleF bounds = new RectangleF(20, 20, 80, 200);
        FillEllipse(e.Graphics, bounds, percent);
    }
    static void FillEllipse(Graphics g, RectangleF bounds, float percent) {
        g.DrawEllipse(Pens.Red, bounds);
        g.SetClip(new RectangleF(
            bounds.X,
            bounds.Y + (1f - percent) * bounds.Height,
            bounds.Width,
            percent * bounds.Height));
    
        g.FillEllipse(Brushes.Red, bounds);
        g.ResetClip();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i increase the distance when i draw a ellipse from a certain
I have this code to draw an ellipse in the screen but I don't
ok i can draw ellipse the problem is this, im trying to draw one
Simple code fragment below draws an ellipse on a VB.NET panel. I now need
The following code will draw an ellipse on an image and fill that ellipse
To draw an ellipse in Qt, we can simply go QGraphicsScene->addEllipse(); Is there an
I am deriving from shape to draw an ellipse. The drawing starts at 0,0
I am trying to use System.Drawing.Drawing2D.GraphicsPath.AddArc to draw an arc of an ellipse starting
In my WPF project I have a canvas on which I draw an ellipse
In C#, am able to draw an ellipse on a screen device context taken

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.