You must Sign In to post a response.
  • Category: .NET

    How to Select content on picturebox image


    Are you looking for a way to Select content on picturebox image ? then read this thread to know more about it



    Hi,

    I have the image which contains like dictionary (scanned image). I want to mark (rectangle box) the each content by mouse after load the image in picture box. I have checked in google, but there is no final result. Can anyone help me.
  • #750231
    Hi Gopi,

    Can you please elaborate your requirement to provide some what better solution to resolve this issue.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #750265
    Hi,

    You can see the attached image. I want to select the each words. From the first word "CARPENTRY", here i want to select from this word till end of the meaning of this word. So the next word should be "CARPER".... There is some additional dataentry on this based on the selected content. Here I need help on select the content...

    -----------------------------------------------------------------------------
    Regards,
    Gopi A.
    +91 9894315571
    Skype:gopi.net
    http://asaigopi-dotnet.blogspot.in/

    Delete Attachment

  • #750273
    Assuming that you have have a picturebox with the id pictureBox1 and an image mapped to the picturebox then the below code will be useful to select a region of picturebox.

    Point RectStartPoint;
    Rectangle rect = new Rectangle();
    Brush selectionBrush = new SolidBrush(Color.FromArgb(128, 72, 145, 220));


    private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
    {
    RectStartPoint = e.Location;
    Invalidate();

    }

    private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
    {
    if (e.Button != MouseButtons.Left)
    return;

    Point tempEndPoint = e.Location;
    rect.Location = new Point(Math.Min(RectStartPoint.X, tempEndPoint.X), Math.Min(RectStartPoint.Y, tempEndPoint.Y));
    rect.Size = new Size(Math.Abs(RectStartPoint.X - tempEndPoint.X), Math.Abs(RectStartPoint.Y - tempEndPoint.Y));
    pictureBox1.Invalidate();
    }

    //occurs when pictureBox needs repainting
    private void pictureBox1_Paint(object sender, PaintEventArgs e)
    {
    //Draw the rectangle
    if(pictureBox1.Image != null)
    {
    if(rect != null && rect.Width > 0 && rect.Height > 0)
    {
    e.Graphics.FillRectangle(selectionBrush, rect);
    }
    }
    }

    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • #750408
    It's not working... I could not see any box to drawn by mouse dragging..
    -----------------------------------------------------------------------------
    Regards,
    Gopi A.
    +91 9894315571
    Skype:gopi.net
    http://asaigopi-dotnet.blogspot.in/


  • Sign In to post your comments