racavi1981
New member
- Joined
- Mar 20, 2008
- Messages
- 1
- Programming Experience
- Beginner
Hi, I have a question concerning the way a save an image that I just edited.
I'm doing a project for an oftalmologist, where he does an eye exam on the pacient and writes a report. In one of the parts of the exam, the doctor has to draw some points over an image indicating where the patient has an injury.
So far, I'm drawing the points on the image using the PictureBox1_MouseDown event. the question comes when I want to save the image that I just edited.
here is the code of my form.
I uploaded the image I want to draw on to
I'm doing a project for an oftalmologist, where he does an eye exam on the pacient and writes a report. In one of the parts of the exam, the doctor has to draw some points over an image indicating where the patient has an injury.
So far, I'm drawing the points on the image using the PictureBox1_MouseDown event. the question comes when I want to save the image that I just edited.
here is the code of my form.
VB.NET:
Imports System
Imports System.Drawing.Graphics
Imports System.Drawing.Imaging
Imports System.Windows.Forms
Public Class Form1
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
Dim graphics As System.Drawing.Graphics = PictureBox1.CreateGraphics()
Dim rectangle As New System.Drawing.Rectangle(e.X, e.Y, 20, 20)
Dim sf As StringFormat = CType(StringFormat.GenericTypographic.Clone(), StringFormat)
If RadioButton1.Checked Then
graphics.FillEllipse(Brushes.Red, rectangle)
End If
If RadioButton2.Checked Then
graphics.FillRectangle(Brushes.Blue, rectangle)
End If
If RadioButton3.Checked Then
sf.Alignment = StringAlignment.Near
sf.LineAlignment = StringAlignment.Near
graphics.DrawString(TextBox2.Text, New Font("Arial", 12, GraphicsUnit.Point), Brushes.Black, New RectangleF(e.X, e.Y, 150, 30), sf)
End If
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
TextBox1.Text = ("X=" & e.X & "," & "Y= " & e.Y)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Refresh()
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked Then
Label1.Visible = True
TextBox2.Visible = True
Else
Label1.Visible = False
TextBox2.Visible = False
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim im_rot As Bitmap = PictureBox1.Image
im_rot.Save("C:\Documents and Settings\Rafael Cano\My Documents\Visual Studio 2005\Projects\imagen\imagenes\prueba5.gif")
End Sub
End Class
I uploaded the image I want to draw on to