tif文件缩略图预览 [英] tif file thumbnail preview
问题描述
你好,艾伦,谢谢你的病人.
我有许多控件可以产生在标签(lblCurrentFileName)中显示的文件名.
我有一个分组框(gbFileToPreview),可产生文件名的缩略图.
运行代码时,它将在缩略图中生成正确的CurrentFileName图像.
我意识到在lblCurrentFileName_TextChanged事件中,我必须放置一些代码,但是我尝试了十二次不同的尝试,只是不断出错.
我的代码如下所示:
-------------------------------------------------- -----------------------------------
私人子GetThumbnail(ByVal e作为PaintEventArgs)
昏暗的UseThis作为字符串= lblCurrentFileName.Text
昏暗回调作为新Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
将图像变暗为图像=新位图("C:\ DIMS \ Steve' s扫描的图形\" + UseThis)
将Dim pThumbnail设为Image = image.GetThumbnailImage(200,200,callback,New IntPtr())
e.Graphics.DrawImage(pThumbnail,20、20,pThumbnail.Width,pThumbnail.Height)
结束子
-------------------------------------------------- -----------------------------------
公共函数ThumbnailCallback()为布尔值
返回True
最终功能
-------------------------------------------------- -----------------------------------
私有子lblCurrentFileName_TextChanged(ByVal发送者作为对象,ByVal e作为System.EventArgs)处理lblCurrentFileName.TextChanged
''GetThumbnail(e)...已经尝试过并产生异常错误
''调用gbFileToPreview_Paint(sender,e)...同一件事是一个错误
结束子
-------------------------------------------------- -----------------------------------
私人Sub gbFileToPreview_Paint(ByVal发送者作为对象,ByVal e作为System.Windows.Forms.PaintEventArgs)处理gbFileToPreview.Paint
GetThumbnail(e)
结束子
您有什么建议可以在lblCurrentFileName_TextChanged事件中使用什么代码来重新绘制具有新的当前文件名的缩略图...?
再次感谢您的病人,
Stephen
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
推荐答案
帮帮我,以便我可以帮助您...您打算在什么时候重新粉刷groupbox?您是否正在使用标签的TextChanged
事件?而且,您从哪里获得文件名?您在使用OpenFileDialog吗?
如果您在回复中张贴一些代码,则会增加获得帮助的机会. :-)
Help me a little so I can help you... At what point are you trying to repaint the groupbox? Are you using the label''sTextChanged
event? And, where do you get the file names? Are you using a OpenFileDialog?
If you''ll post some code in your reply you''ll increase your chances of getting help. :-)
这篇关于tif文件缩略图预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!