使用存储在Access中的路径以vb.net形式显示jpeg。 [英] Display jpeg in vb.net form by using path stored in Access.

查看:61
本文介绍了使用存储在Access中的路径以vb.net形式显示jpeg。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人可以怜悯并帮我解决这个问题,那么在我完全疯狂之前,我会非常感激。


这就是我正在尝试的要做的:


我有一个Access 2003数据库,其中包含一个表(其中包含)保存存储在外部文件夹中的众多jpeg图像的文件名。 O / S是Windows XP专业版。 btw。


我还有一个连接到数据库的vb.net 2008表单。这部分工作正常,所有字段都显示在表单上,​​我可以毫无问题地逐步浏览所有记录。


但这里是'我在哪里'我被卡住了。我想要做的是在我的表单上有一个图片字段,它将显示不同的缩略图jpeg,这对每个dbase记录都是唯一的。路径的信息部分由包含图像文件夹路径的字符串提供。为此,我想在每个数据库条目出现时附加我将从表格中的相关字段获得的每个单独的图像名称。


但我得到的只是一个在它的红十字框。我可以在我的表单上获取图片框以显示与每个记录保持相同的单个图像,但显然我希望图像在正在查看的记录上更改。


有什么想法吗?

TIA。

If someone could take pity and help me out with this before I drive myself completely nuts, then I would really appreciate it.

Here''s what I''m trying to do:

I have an Access 2003 database containing a table which (amongst other things) holds the filenames of numerous jpeg images stored in an external folder. O/S is Windows XP Pro. btw.

I also have a vb.net 2008 form connected to the database. That part works fine, all the fields show up on the form, and I am able to step through all of the records with no problem.

But here''s where I''m stuck. What I want to do is have a picture field on my form which will display different thumbnail jpegs which are unique to each dbase record. The information for the path is provided in part by a string containing the path to the image folder. To this I want to append each individual image name which I''ll get from the relevant field on my form as each database entry appears.

But all I''m getting is a box with a red cross in it. I can get the picture box on my form to display a single image that stays the same with each record, but obviously I want the image to change depoending on the record being viewed.

Any ideas?
TIA.

推荐答案

你能在代码中访问Image控件吗? ?

如果是这样,请尝试查看它的一些方法和属性,并找出哪一个是图像的路径。尝试在图像控件上设置路径(使用设计模式中的属性选项)。然后在运行时访问控件(使用按钮)并尝试将此文件路径操作到数据库中的一个。


您只需要修改此值即可更改图像显示。


希望这会有所帮助。

http://www.db-pros.com
Can you access the Image control in code?
If so, try looking at some of the methods and properties of it, and find which one is the path to the image. Try setting the path on an image control (using the Properties options in design mode). Then access the control at run time (using a button) and try manipulating this file path to one of the ones in your database.

You should just need to modify this value to change the image display.

Hope this helps.

http://www.db-pros.com


感谢您的意见。

事情正在发生变化,(慢慢地)。

这就是我现在所拥有的:


Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button1.Click


PictureBox1.ImageLocation =" E:\Visual_Basic_Projects\movies_01\movies_01\bin\ Debug\thumb_pics \" &安培; " tn_" &安培; FilenameTextBox.Text& " .jpg"


结束子


goood新闻是这段代码生成所需的缩略图,与之匹配数据库记录有问题。但问题是,它依赖于按钮点击 - 我必须单击按钮才能使图像更新为当前显示的记录。当然,我希望缩略图在每个单独的记录显示时自动显示,但这仍然令我感到烦恼。
Thanks for your input.
Things are moving along, (slowly).
Here''s what I have now:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

PictureBox1.ImageLocation = "E:\Visual_Basic_Projects\movies_01\movies_01\bin\ Debug\thumb_pics\" & "tn_" & FilenameTextBox.Text & ".jpg"


End Sub

The goood news is that this code produces the desired thumbnail image, matching the database record in question. The problem though, is that it relies on the button click - I have to click the button to get the image to update to the currently displayed record. Naturally, I want the thumbnail image to appear automatically as each individual record is displayed, but this is still vexing me.


我现在已根据原始查询解决了问题,但是我会很感激有关vb.net表单的一些意见。有可能有一个ListBox,或者ListView框,或......任何......可能包含图像?我不是在谈论简单的图标,而是稍大的图像。我希望在运行时通过使用Access数据库引用图像路径来填充这样的盒子,以生成一个滚动的图像框和(希望)文本旁边。


是这甚至可能远吗???
I now have things ironed out, in respect of my original query, but would appreciate a bit of input regarding vb.net forms. Is it possible to have a ListBox, or maybe a ListView box, or...... anything... which could contain images? I''m not talking about simply icons here either, but slightly larger images. I''m hoping to populate such a box at run time by referencing paths to images using an Access database, to produce a scrolling box of images and (hopefully) text alongside.

Is this even remotely possible???


这篇关于使用存储在Access中的路径以vb.net形式显示jpeg。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆