Solved

Paint circles on an image

Posted on 2013-12-26
5
283 Views
Last Modified: 2013-12-27
I need to implement a work sheet for a workshop mechanics. I need to record in a car which damaged parts (As attached picture shows). What better way to do it.
Img.jpg
0
Comment
Question by:rflorencio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39739882
What kind of application are you building:  WinForms, WPF, web?
0
 

Author Comment

by:rflorencio
ID: 39739943
winforms
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39739947
You marked this as both VB.NET and C#. Which language are you using?
0
 

Author Comment

by:rflorencio
ID: 39739995
Vb.net, first option.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39740003
Here's one way to do it:

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.PictureBox1.Tag = Me.PictureBox1.Image.Clone()  ' Create a copy that we can use to clear the image
    End Sub

    Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp
        Dim centerPoint As Point = e.Location  ' Where did we click?

        centerPoint.Offset(-10, -10)  ' Offset the circle so that it is drawn with the center where we clicked

        Using g As Graphics = Graphics.FromImage(Me.PictureBox1.Image)  ' We need a Graphics object in order to do drawing on the image
            g.FillEllipse(Brushes.Red, New Rectangle(centerPoint, New Size(20, 20)))  ' Draw the circle
        End Using

        Me.PictureBox1.Invalidate()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.PictureBox1.Image = DirectCast(Me.PictureBox1.Tag, Image).Clone()  ' Assign the copy we made above as a "clean" image. Be sure to copy it (the Clone method)!!
        Me.PictureBox1.Invalidate()
    End Sub
End Class

Open in new window


 Screenshot
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question