Hello Alan, thanks for your patients.
I have a number of controls that produce the file name that is displayed in the label (lblCurrentFileName)
I have a groupbox (gbFileToPreview) that produces the thumbnail of the file name.
When the code is run it produces the correct CurrentFileName image in the thumbnail.
I realise that in the lblCurrentFileName_TextChanged event I have to put some code but I have tried a dozen different times and just keep getting errors.
The code I have looks like this:
-------------------------------------------------------------------------------------
Private Sub GetThumbnail(ByVal e As PaintEventArgs)
Dim UseThis As String = lblCurrentFileName.Text
Dim callback As New Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
Dim image As Image = New Bitmap("C:\DIMS\Steve's Scanned Drawings\" + UseThis)
Dim pThumbnail As Image = image.GetThumbnailImage(200, 200, callback, New IntPtr())
e.Graphics.DrawImage(pThumbnail, 20, 20, pThumbnail.Width, pThumbnail.Height)
End Sub
-------------------------------------------------------------------------------------
Public Function ThumbnailCallback() As Boolean
Return True
End Function
-------------------------------------------------------------------------------------
Private Sub lblCurrentFileName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblCurrentFileName.TextChanged
'GetThumbnail(e)... have tried this and creates an exception error
'Call gbFileToPreview_Paint(sender,e)... same thing an error
End Sub
-------------------------------------------------------------------------------------
Private Sub gbFileToPreview_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles gbFileToPreview.Paint
GetThumbnail(e)
End Sub
Do you have any suggestions what code I can use in the lblCurrentFileName_TextChanged event to re-paint the thumbnail with the new current file name...?
Thanks again for your patients,
Stephen