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

  • Home
  • SEARCH
  • 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 653817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:25:29+00:00 2026-05-13T22:25:29+00:00

I have to represent graphically an oriented graph like in the image below. alt

  • 0

I have to represent graphically an oriented graph like in the image below.

alt text http://img694.imageshack.us/img694/1605/graf.gif

i have a C# form, when i click with the mouse on it i have to draw a node. If i click somewhere on the form where is not already a node drawn it means i cliked with the intetion of drawing a node, if it is a node there i must select it and memorize it. On the next mouse click if i touch a place where there is not already a node drawn it means like before that i want to draw a new node, if it is a node where i clicked i need to draw the line from the first memorized node to the selected one and add road cost details.

i know how to draw the circles that represent the nodes of the graph when i click on the form. i’m using the following code:

namespace RepGraficaAUnuiGraf
{
    public partial class Form1 : Form
    {
        Graphics graphDrawingArea;
        Bitmap bmpDrawingArea;
        Graphics graph;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            bmpDrawingArea = new Bitmap(Width, Height);
            graphDrawingArea = Graphics.FromImage(bmpDrawingArea);
            graph = Graphics.FromHwnd(this.Handle);
        }

        private void Form1_Click(object sender, EventArgs e)
        {          
            DrawCentralCircle(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y, 15);
            graph.DrawImage(bmpDrawingArea, 0, 0);
        }

        void DrawCentralCircle(int CenterX, int CenterY, int Radius)
        {
            int start = CenterX - Radius;
            int end = CenterY - Radius;
            int diam = Radius * 2;
            bmpDrawingArea = new Bitmap(Width, Height);
            graphDrawingArea = Graphics.FromImage(bmpDrawingArea);
            graphDrawingArea.DrawEllipse(new Pen(Color.Blue), start, end, diam, diam);
            graphDrawingArea.DrawString("1", new Font("Tahoma", 13), Brushes.Black, new PointF(CenterX - 8, CenterY - 10));
        }

    }
}

My question is how can i find out if at the coordinates (x,y) on my form i drew a node and which one is it? I thought of representing the nodes as buttons, having a tag or something similar as the node number(which in drawing should be 1 for Santa Barbara, 2 for Barstow etc.)

  • 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-13T22:25:29+00:00Added an answer on May 13, 2026 at 10:25 pm

    Expanding upon the answer from Anders Abel:

    • keep a list storing information about each node including
    • center point
    • radius
    • other relevant information …

    When you click determine whether one of the nodes was hit

    • iterate through all of the nodes
    • find the distance from the click point to the center of the node using the Pythagorean Theorem
    • if the distance is less than the radius then select the node
    • if a node was not selected then add a new node at the clicked location
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 542k
  • Answers 542k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use: SELECT p.id as a, p.url as b, t.id as… May 17, 2026 at 3:22 am
  • Editorial Team
    Editorial Team added an answer There are two parts to the problem First Issue You… May 17, 2026 at 3:19 am
  • Editorial Team
    Editorial Team added an answer I thought I'd show the regex approach, too. It doesn't… May 17, 2026 at 3:18 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have around 3500 flood control facilities that I would like to represent as
I have some constants that represent the valid options in one of my model's
I have some tables that represent various types. They usually just consist of an
I have a sort of tree structure that represent a hierarchy of layers in
I have a list of (64-bit) addresses that represent a stack frame, and I
I have a byte[] array, the contents of which represent a TIFF file (as
I have started coding an FTP client application (for fun). I’m trying to represent
My application receives strings that represent objects. I have to parse the strings to
i have very simple problem. I need to create model, that represent element of
We're using interfaces to represent entity classes in our domain model. We have concrete

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.