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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:03:56+00:00 2026-05-20T00:03:56+00:00

I’m working with images like: https://i.stack.imgur.com/zmQr0.jpg I’ve managed to find a vertical line between

  • 0

I’m working with images like: https://i.stack.imgur.com/zmQr0.jpg

I’ve managed to find a vertical line between pages on scanned image. But sometimes there are some errors and I need to make an option for user to change this line position and angle. I think this would be nice within a PictureBox.

I need somehow to draw a line between two movable points on a picturebox with current image. When I move a point, position of line and it’s angle have to be changed properly.

  • 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-20T00:03:57+00:00Added an answer on May 20, 2026 at 12:03 am

    Here is a sample code you can use for your need. It basically uses 4 events :
    – Paint
    – MouseDown
    – MouseMove
    – MouseUp

    You can copy-paste this code to a form called Form1, with a picture box called pictureBox1

        int handleRadius = 3;
        int mPointMoveInProgress = 0;
        Point mPoint1, mPoint2;
    
        public Form1()
        {
            InitializeComponent();
    
            mPoint1 = new Point(50, 50); // Set correct default values
            mPoint1 = new Point(50, 300); // Set correct default values
        }
    
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            // Draw line
            e.Graphics.DrawLine(new Pen(Color.Black, 2), mPoint1, mPoint2);
    
            Rectangle rectangle;
    
            // Draw first handle
            rectangle = new Rectangle(mPoint1.X - handleRadius, mPoint1.Y - handleRadius, handleRadius * 2, handleRadius * 2);
            e.Graphics.FillRectangle(Brushes.White, rectangle);
            e.Graphics.DrawRectangle(Pens.Black, rectangle);
    
            // Draw second handle
            rectangle = new Rectangle(mPoint2.X - handleRadius, mPoint2.Y - handleRadius, handleRadius * 2, handleRadius * 2);
            e.Graphics.FillRectangle(Brushes.White, rectangle);
            e.Graphics.DrawRectangle(Pens.Black, rectangle);
        }
    
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            // Determine if a point is under the cursor. If so, declare that a move is in progress
            if (Math.Abs(e.X - mPoint1.X) < handleRadius && Math.Abs(e.Y - mPoint1.Y) < handleRadius) mPointMoveInProgress = 1;
            else if (Math.Abs(e.X - mPoint2.X) < handleRadius && Math.Abs(e.Y - mPoint2.Y) < handleRadius) mPointMoveInProgress = 2;
            else mPointMoveInProgress = 0;
        }
    
        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (mPointMoveInProgress == 1) // If moving first point
            {
                mPoint1.X = e.X ;
                mPoint1.Y = e.Y ;
                Refresh();
            }
            else if (mPointMoveInProgress == 2) // If moving second point
            {
                mPoint2.X = e.X ;
                mPoint2.Y = e.Y ;
                Refresh();
            }
            else // If moving in the PictureBox: change cursor to hand if above a handle
            {
                if (Math.Abs(e.X - mPoint1.X) < handleRadius && Math.Abs(e.Y - mPoint1.Y) < handleRadius) Cursor.Current = Cursors.Hand;
                else if (Math.Abs(e.X - mPoint2.X) < handleRadius && Math.Abs(e.Y - mPoint2.Y) < handleRadius) Cursor.Current = Cursors.Hand;
                else Cursor.Current = Cursors.Default;
            }
        }
    
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            // Declare that no move is in progress
            mPointMoveInProgress = 0;
        }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I want use html5's new tag to play a wav file (currently only supported
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.