Hi ! I just started on visual basic....i made a windows form application where when user open it they have to enter a user name and password to get in and then another form opens up where i would like to do this :
1. Allow a user to click on the button to upload an image.
2. There should also be two buttons on the left hand side labeled 1 as X and the other as O. So, when the user uploads an image he starts labeling the image with X's and O's but i also want that when he is click the X's and O's the program is storing those points to generate a summary of Xs and Os at the end.
3. The user should be able to zoom in and zoom out on the pic.
4. When the user clicks on X or the O's the program should ask a series of questions and that information would be used to generate the summary of click points at the end.
5. And, once he is done labeling, he should be able to save the file.
6. There should be a button that says done so the program knows to generate a documentation for it.
7. On the top, there should also be bar that has option like help when u click on it, it gives you a text file.
This is a very simple program. please help me do this. thanks ! If you could code it, i would appreciate it.
the image when i downloaded can be resized....i mean the user should be able to zoom in and zoom out of the photo...
one more thing the X and O you add has to be red color also when you are making a log the location has to be userdefined so each time user clicks on something the program should ask the user what is it called... and it should generate the log in excel file if possible
Also, x and o when you mark on the photo has to be 72 points in size you know so you can zoom in on the photo and then mark it and then zoom out and then save.
So far ,
My code is
Public Class frmLogin
Public xUser As String = "username"
Public xPass As String = "password"
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
If txtUsername.Text = xUser Then
If txtPassword.Text = xPass Then
frmMain.Show()
Me.Close()
Else
MsgBox("Incorrect password")
End If
Else
MsgBox("Incorrect username")
End If
End Sub
End Class.
Public Class frmMain
Public XOSelected As Integer = 0
'0 for x and 1 for o
Public MousePos As Point
Public XOLog As String
Private Sub btnUpload_Click(sender As Object, e As EventArgs) Handles btnUpload.Click
opnfldlgChooseImage.ShowDialog()
End Sub
Private Sub opnfldlgChooseImage_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles opnfldlgChooseImage.FileOk
Try
pctrUsersImage.BackgroundImage = Image.FromFile(opnfldlgChooseImage.FileName)
btnX.Enabled = True
btnO.Enabled = True
Catch ex As Exception
End Try
End Sub
Private Sub btnX_Click(sender As Object, e As EventArgs) Handles btnX.Click
XOSelected = 0
SelectedChanged()
End Sub
Private Sub btnO_Click(sender As Object, e As EventArgs) Handles btnO.Click
XOSelected = 1
SelectedChanged()
End Sub
Public Sub SelectedChanged()
If XOSelected = 0 Then
lblSelected.Text = "Selected: X"
ElseIf XOSelected = 1 Then
lblSelected.Text = "Selected: O"
End If
End Sub
Private Sub pctrUsersImage_MouseUp(sender As Object, e As MouseEventArgs) Handles pctrUsersImage.MouseUp
Dim Gfx As Graphics = Graphics.FromImage(pctrUsersImage.BackgroundImage)
If XOSelected = 0 Then
Gfx.DrawString("X", New Font("Calibri", 12), New SolidBrush(Color.White), MousePos.X, MousePos.Y)
Gfx.Dispose()
If XOLog = "" Then
XOLog = "X added at: x: " & MousePos.X & " y: " & MousePos.Y
Else
XOLog = XOLog & vbNewLine & "X added at: x: " & MousePos.X & " y: " & MousePos.Y
End If
ElseIf XOSelected = 1 Then
Gfx.DrawString("O", New Font("Calibri", 12), New SolidBrush(Color.White), MousePos.X, MousePos.Y)
Gfx.Dispose()
If XOLog = "" Then
XOLog = "O added at: x: " & MousePos.X & " y: " & MousePos.Y
Else
XOLog = XOLog & vbNewLine & "O added at: x: " & MousePos.X & " y: " & MousePos.Y
End If
End If
Me.Refresh()
End Sub
Private Sub pctrUsersImage_MouseMove(sender As Object, e As MouseEventArgs) Handles pctrUsersImage.MouseMove
MousePos = pctrUsersImage.PointToClient(Cursor.Position)
End Sub
Private Sub btnSaveImage_Click(sender As Object, e As EventArgs) Handles btnSaveImage.Click
svfldlgSaveImage.ShowDialog()
End Sub
Private Sub svfldlgSaveImage_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles svfldlgSaveImage.FileOk
Dim path As String = svfldlgSaveImage.FileName
Dim bmp As Bitmap
Try
bmp = Me.pctrUsersImage.BackgroundImage
bmp.Save(path)
My.Computer.FileSystem.WriteAllText(Application.StartupPath & "\XO Log.txt", XOLog, False)
MsgBox("Image and log file has been generated, I will now open them for you. The log contains every position of the X and O.")
Process.Start(svfldlgSaveImage.FileName)
Process.Start(Application.StartupPath & "\XO Log.txt")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
1. Allow a user to click on the button to upload an image.
2. There should also be two buttons on the left hand side labeled 1 as X and the other as O. So, when the user uploads an image he starts labeling the image with X's and O's but i also want that when he is click the X's and O's the program is storing those points to generate a summary of Xs and Os at the end.
3. The user should be able to zoom in and zoom out on the pic.
4. When the user clicks on X or the O's the program should ask a series of questions and that information would be used to generate the summary of click points at the end.
5. And, once he is done labeling, he should be able to save the file.
6. There should be a button that says done so the program knows to generate a documentation for it.
7. On the top, there should also be bar that has option like help when u click on it, it gives you a text file.
This is a very simple program. please help me do this. thanks ! If you could code it, i would appreciate it.
the image when i downloaded can be resized....i mean the user should be able to zoom in and zoom out of the photo...
one more thing the X and O you add has to be red color also when you are making a log the location has to be userdefined so each time user clicks on something the program should ask the user what is it called... and it should generate the log in excel file if possible
Also, x and o when you mark on the photo has to be 72 points in size you know so you can zoom in on the photo and then mark it and then zoom out and then save.
So far ,
My code is
Public Class frmLogin
Public xUser As String = "username"
Public xPass As String = "password"
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
If txtUsername.Text = xUser Then
If txtPassword.Text = xPass Then
frmMain.Show()
Me.Close()
Else
MsgBox("Incorrect password")
End If
Else
MsgBox("Incorrect username")
End If
End Sub
End Class.
Public Class frmMain
Public XOSelected As Integer = 0
'0 for x and 1 for o
Public MousePos As Point
Public XOLog As String
Private Sub btnUpload_Click(sender As Object, e As EventArgs) Handles btnUpload.Click
opnfldlgChooseImage.ShowDialog()
End Sub
Private Sub opnfldlgChooseImage_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles opnfldlgChooseImage.FileOk
Try
pctrUsersImage.BackgroundImage = Image.FromFile(opnfldlgChooseImage.FileName)
btnX.Enabled = True
btnO.Enabled = True
Catch ex As Exception
End Try
End Sub
Private Sub btnX_Click(sender As Object, e As EventArgs) Handles btnX.Click
XOSelected = 0
SelectedChanged()
End Sub
Private Sub btnO_Click(sender As Object, e As EventArgs) Handles btnO.Click
XOSelected = 1
SelectedChanged()
End Sub
Public Sub SelectedChanged()
If XOSelected = 0 Then
lblSelected.Text = "Selected: X"
ElseIf XOSelected = 1 Then
lblSelected.Text = "Selected: O"
End If
End Sub
Private Sub pctrUsersImage_MouseUp(sender As Object, e As MouseEventArgs) Handles pctrUsersImage.MouseUp
Dim Gfx As Graphics = Graphics.FromImage(pctrUsersImage.BackgroundImage)
If XOSelected = 0 Then
Gfx.DrawString("X", New Font("Calibri", 12), New SolidBrush(Color.White), MousePos.X, MousePos.Y)
Gfx.Dispose()
If XOLog = "" Then
XOLog = "X added at: x: " & MousePos.X & " y: " & MousePos.Y
Else
XOLog = XOLog & vbNewLine & "X added at: x: " & MousePos.X & " y: " & MousePos.Y
End If
ElseIf XOSelected = 1 Then
Gfx.DrawString("O", New Font("Calibri", 12), New SolidBrush(Color.White), MousePos.X, MousePos.Y)
Gfx.Dispose()
If XOLog = "" Then
XOLog = "O added at: x: " & MousePos.X & " y: " & MousePos.Y
Else
XOLog = XOLog & vbNewLine & "O added at: x: " & MousePos.X & " y: " & MousePos.Y
End If
End If
Me.Refresh()
End Sub
Private Sub pctrUsersImage_MouseMove(sender As Object, e As MouseEventArgs) Handles pctrUsersImage.MouseMove
MousePos = pctrUsersImage.PointToClient(Cursor.Position)
End Sub
Private Sub btnSaveImage_Click(sender As Object, e As EventArgs) Handles btnSaveImage.Click
svfldlgSaveImage.ShowDialog()
End Sub
Private Sub svfldlgSaveImage_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles svfldlgSaveImage.FileOk
Dim path As String = svfldlgSaveImage.FileName
Dim bmp As Bitmap
Try
bmp = Me.pctrUsersImage.BackgroundImage
bmp.Save(path)
My.Computer.FileSystem.WriteAllText(Application.StartupPath & "\XO Log.txt", XOLog, False)
MsgBox("Image and log file has been generated, I will now open them for you. The log contains every position of the X and O.")
Process.Start(svfldlgSaveImage.FileName)
Process.Start(Application.StartupPath & "\XO Log.txt")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class