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 7037785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:35:13+00:00 2026-05-28T01:35:13+00:00

I just want to draw an ellipse dynamically when running . mouseclick then mousemove

  • 0

I just want to draw an ellipse dynamically when running . mouseclick then mousemove and then mouse release that’s it . But, confused of detecting point(x,y).Can someone help me out of this

  • 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-28T01:35:14+00:00Added an answer on May 28, 2026 at 1:35 am

    You basically just need to record the starting point from the MouseDown event, so that you can make the ellipse with the point recorded from the MouseUp event.

    Simple demo:

    public partial class Form1 : Form {
    
      private Point _StartPoint;
      private List<Rectangle> _Ovals = new List<Rectangle>();
    
      public Form1() {
        InitializeComponent();
    
        this.MouseDown += new MouseEventHandler(Form1_MouseDown);
        this.MouseUp += new MouseEventHandler(Form1_MouseUp);
        this.Paint += new PaintEventHandler(Form1_Paint);
      }
    
      void Form1_Paint(object sender, PaintEventArgs e) {
        foreach (Rectangle r in _Ovals)
          e.Graphics.FillEllipse(Brushes.Red, r);
      }
    
      void Form1_MouseDown(object sender, MouseEventArgs e) {
        if (e.Button == MouseButtons.Left)
          _StartPoint = e.Location;
      }
    
      void Form1_MouseUp(object sender, MouseEventArgs e) {
        if (e.Button == MouseButtons.Left) {
          _Ovals.Add(MakeRectangle(_StartPoint, e.Location));
          this.Invalidate();
        }
      }
    
      private Rectangle MakeRectangle(Point p1, Point p2) {
        int x = (p1.X < p2.X ? p1.X : p2.X);
        int y = (p1.Y < p2.Y ? p1.Y : p2.Y);
        int w = Math.Abs(p1.X - p2.X);
        int h = Math.Abs(p1.Y - p2.Y);
        return new Rectangle(x, y, w, h);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to draw a gradient, but first I just want to get the
I've created a custom view class and right now just want to draw an
Just want to know if there other optional wrapper framework available that generate client
I just want my apache to register some of my predefined environment so that
I just want a simple tool that will help me quickly write scripts/packages that
I just want to draw simple 2D objects like circle, line, square etc in
What I want to do is to draw a line that will follow my
I'm a beginner. I just want to draw a simple line without using IB
I just want to draw a cylinder in opengl. I found lots of samples
I want draw on the background (like a rectangle or such) and then have

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.