
June 4th, 2012, 04:35 AM
|
|
Contributing User
|
|
Join Date: Sep 2009
Posts: 47
Time spent in forums: 10 h 11 m 31 sec
Reputation Power: 4
|
|
|
Text on picturebox
I have form in VB 2010 and want to display numerous textbox data on top of the picturebox before saving.
Using the following code, I can place the text from holeidtext on top of the picturebox but once I move off the field, it disappears.
I want ALL text boxes to display on the form as I change the data but remain on the form even when the form is resized.
I have done numerous web searches but am unable to find a solution. Any thoughts or web links would be appreciated.
Thanks
Code:
Public Class Form1
Private pictureFileList As New List(Of String)
Private picNumber As Integer = 0
Private maxPicNumber As Integer = 0
'Declaration
Private Sub importButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles importButton.Click
If importBrowser.ShowDialog() = DialogResult.OK Then
importDirectoryText.Text = importBrowser.SelectedPath
My.Settings.importDialog = importDirectoryText.Text
My.Settings.Save()
End If
End Sub
Private Sub exportButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exportButton.Click
If exportBrowser.ShowDialog() = DialogResult.OK Then
exportDirectoryText.Text = exportBrowser.SelectedPath
My.Settings.exportDialog = exportDirectoryText.Text
My.Settings.Save()
End If
End Sub
Private Sub form1_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
importDirectoryText.Text = My.Settings.importDialog
exportDirectoryText.Text = My.Settings.exportDialog
End Sub
Private Sub loadImageButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loadImageButton.Click
PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
For Each pic As String In My.Computer.FileSystem.GetFiles(importDirectoryText.Text, FileIO.SearchOption.SearchTopLevelOnly, "*.jpg")
pictureFileList.Add(pic)
maxPicNumber = maxPicNumber + 1
Next
maxPicNumber = maxPicNumber - 1
imageload()
End Sub
Private Sub backButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles backButton.Click
picNumber = picNumber - 1
If picNumber < 0 Then
picNumber = maxPicNumber
End If
imageload()
End Sub
Private Sub forwardButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles forwardButton.Click
picNumber = picNumber + 1
If picNumber > maxPicNumber Then
picNumber = 0
End If
imageload()
End Sub
Private Sub imageload()
PictureBox1.Load(pictureFileList(picNumber))
End Sub
Private Sub holeidText_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles holeidText.TextChanged
Dim g As Graphics = PictureBox1.CreateGraphics
Dim x As Integer = 20
Dim y As Integer = 30
g.DrawString("HoleID : " + holeidText.Text, New Font("Arial", 12), Brushes.Black, x, y)
End Sub
End Class
|