473,883 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying images in a picture box

I am trying to display an image in a picture box. The image is a group 4 fax
black and white image of a piece of sheet music. The original resolution is
300 X 300 dpi. I want to have the picture box as large as possible so I can
view the scanned image on my computer screen. At run time, I want to be able
to view different files by changing the image file name property.

I thought the picture box could be setup so that the image would be
stretched or compressed to fit inside the picture box but I have not been
able to do so. It seems that the imageis to large for the picture box.
Perhaps I am not using the picture box options correctly.

So my question is..Is this the right control for this task, and if so, what
am I doing wrong?
Nov 21 '05
14 5581
Hamil,

<STAThread()> _
Shared Sub Main
Application.Run (New Form1())
End Sub

Why is he doing this??

I have made a new sample, however. This is a kind of using the same method
as C# does it STAT mean static appartment model. In VBNet is this build in
in the mainform. If you use this than you have to set in your properties
that Sub Main is the startup object.

Because in my opinion the sample you gave me did not do what you asked (it
draws a bitmap on a screen), have I made a little dirty sample myselfs (it
works). You have yourself make the resizing accoording to your form/imagebox
format.

http://www.windowsformsdatagridhelp....c-fd5823b51f41

I hope this helps,

Cor
Nov 21 '05 #11
Oeps,

STA single treaded apartment

http://msdn.microsoft.com/library/de...classtopic.asp

Cor
Nov 21 '05 #12
YES! I tried your code, IT WORKS!

I am getting the picture now (no pun intended). One last question...I hope.

When I open my original tif document using a viewer, such as Irfanview, the
image is very clear, in that the jagged edges are cleaned up. My input file
is a scanned page of sheet music with horizontal lines. Obviously, Irfanview
does some kind of resampling or filtering when they reduce the pixel
dimension of the tif page.

When the DrawImage is performed in your routine, it seems that no resampling
or or filtering is taking place. What happens is that there are gaps in the
horizontal lines. I suspect that there is a method that can be used to
perform the resizing in a better manner. Perhaps the DrawImage method merely
takes every third pixel for example while a better resizing would do a better
job perhaps by taking three pixels , doing an average, or something like that.

I see tht there are some converter routines available but I don't know which
one to use or how to do so. I would think that the code would be something
like...

MyImage = image.fromfile( "C:\myfile.tif" )
ReducedImage = MyImage.resampl e(ReductionPerc entage)
graphics.drawim age ReducedImage

What do you think??

Hamil.





"Cor Ligthert [MVP]" wrote:
Hamil,

<STAThread()> _
Shared Sub Main
Application.Run (New Form1())
End Sub

Why is he doing this??

I have made a new sample, however. This is a kind of using the same method
as C# does it STAT mean static appartment model. In VBNet is this build in
in the mainform. If you use this than you have to set in your properties
that Sub Main is the startup object.

Because in my opinion the sample you gave me did not do what you asked (it
draws a bitmap on a screen), have I made a little dirty sample myselfs (it
works). You have yourself make the resizing accoording to your form/imagebox
format.

http://www.windowsformsdatagridhelp....c-fd5823b51f41

I hope this helps,

Cor

Nov 21 '05 #13
Hamil,

Look on our page, this was a very simple sample. Peter Proost gave a new
more extended one. Maybe you can try that as well.

http://www.windowsformsdatagridhelp....5-3479119c0d1c

Cor
Nov 21 '05 #14
Thank you! This is exactly what I was looking for. The jaggies are filtered
out by the more advanced interpolation filter. I will now spend some time
learning all the details of *how* this works now that I have a good example.
Thanks again for your help

Haml.
"Cor Ligthert [MVP]" wrote:
Hamil,

Look on our page, this was a very simple sample. Peter Proost gave a new
more extended one. Maybe you can try that as well.

http://www.windowsformsdatagridhelp....5-3479119c0d1c

Cor

Nov 21 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7340
by: Gregory | last post by:
Hello, I've managed to build two web pages, one that can display images with associated text data in a table, and one that can resize and display images without the text. I'd like to resize the images as I go, without writing them to disk on the server. Do I need to prepare all of the resized images before I display the data from the select (which is put into an array by php). How can I display a resized image in a table, without writing...
3
3362
by: Sp33di3 | last post by:
I've been searching and searching for this and there are lots of posts - but very few answers. I have a SQL2000 Database that has jpg images in a table that I want to display in a webpage. I can return all the other information in the database except the pictures. I can't take the images out and link them. I have 2 different results. The code included below gives me a page that says "This is a picture:" and then box with a red X. ...
7
2349
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application. 1. If the images are stored in the DB then, every an image is requested, it will need to be pulled out and a temp file created and then displayed? What is the best way to do this?
4
3958
by: Lindsey Howell | last post by:
Hello, I've encountered a problem when trying to display BLOB images from a SQL database using VB.NET. This is the code which generates the error: Dim mySqlConnection As SqlConnection = New SqlConnection(connectionString) Dim mySqlCommand As SqlCommand = New SqlCommand(queryString, mySqlConnection) Dim ms as MemoryStream = New MemoryStream
0
864
by: dkalsow | last post by:
Good Afternoon, I need to create a program that will display images, simular to the Microsoft Picture and fax viewer. I created a vb.net app and put a picture box on it. This works fine except that if the picture is portrait or landscape and then the picture gets stretched out of portion. I can not have it autosize as I need to limit the size of the image but I also need to see it all. Does anyone know how I can have the image fill...
15
22330
by: Jameson | last post by:
Happy New Year, Everyone! I am trying to figure out how to display a bunch of images (mainly JPEGs, but possibly a few GIFs and PNGs as well) that are stored in a local directory on the system. I can do this with the glob() function, but I can't seem to put in a directory other than one within the webroot. For example, I can only put "/uploads" and not "/Volumes/jray/Pictures...". Any ideas how to get around this? If I can't use the...
8
3311
by: Jon Weston | last post by:
I'm setting up an Access2003 database with pictures. I put a bound ole picture ctrl on a form that's source is the table that contains the pictures and follow ALL the directions for embedding a picture. The ctrl in the form only displays the filename of the picture. The underlying table, when opened in table view, shows the word "package" in the field. When I double-click on either it opens the picture, but I can't get it to display. ...
3
2527
by: velu | last post by:
Asp.Net 2 I am trying to display Image from Northwind Database. I ran a queary "SELECT CategoryID, CategoryName, Description, Picture FROM Categories" but the Dataview displayes all the fields except Picture. so i add a Imagefield to display images..but now i get cross icon.. below is the code. correct me where i am wrong....
1
10947
by: blueheelers | last post by:
I have been researching for several hours on the best way to display images in continous forms in Access 2003. For example, I want to display employee name, email, phone, and picture for each record in the recordset. I can have the pictures converted to any usable format, use OLE or linking, whatever needs to be done. So far, the 3 possible solutions I have found are: 1) OLE objects - if you don't have bitmaps associated just...
4
2688
by: redpears007 | last post by:
Hi Again, Throwing this one out to you again as i am not getting anywhere and can find little to no information out there. I am currently displaying images (Jpegs) in access via the routine set up in the article http://support.microsoft.com/kb/285820/en-us. It works fine if the image is under 1000x1000 pixels. It is set up so the user can double click to open the image in its host application.
0
9933
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9786
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10836
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9568
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5794
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5982
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3230
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.