473,811 Members | 4,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load Image

Bob
Hi,

I have a pictureBox.
What is the most efficient way to load an image (png) : FromFile or
FromStream ?
The picture Box is set to Visible = True or Visible = False at the run time.
For the moment i use FromFile, but sometimes, i have an error saying that
the file is all ready in use (can happen or not, and never at the same
moment...)
If i use FromStream, and if i set the Enabled property to false, if another
window is moved on the pictureBox, i have a memory Overflow...

Thanks !
Mar 18 '07 #1
4 7335
VJ
When you get FromFile, the file is locked, so you need to dispose the
picturebox or set it to null... when you no longer use the picturebox or
wish to change it.

Similary FromStream, you have to flush and close the stream, when not
needed...

VJ
"Bob" <no****@nospam. orgwrote in message
news:O$******** *****@TK2MSFTNG P06.phx.gbl...
Hi,

I have a pictureBox.
What is the most efficient way to load an image (png) : FromFile or
FromStream ?
The picture Box is set to Visible = True or Visible = False at the run
time.
For the moment i use FromFile, but sometimes, i have an error saying that
the file is all ready in use (can happen or not, and never at the same
moment...)
If i use FromStream, and if i set the Enabled property to false, if
another window is moved on the pictureBox, i have a memory Overflow...

Thanks !

Mar 18 '07 #2
Bob
Ok, but i only do the FromFile once, in the constructor.
After, like with a timer, i have my picturebox set to visible = false or
true, just like a blinking if you want.
Then, after a couple of minutes of blinking, i have the "already in use"
message (and the gif loaded in the picturebox is replaced with a red cross
with blank background..)

Do i have to do a FromFile then a Dispose instead of a Visible = true/false
?

Thanks.
Mar 19 '07 #3
VJ
can you post a sample outline of your code, that describes or can reproduce
the problem?

VJ

"Bob" <no****@nospam. orgwrote in message
news:uT******** ******@TK2MSFTN GP04.phx.gbl...
Ok, but i only do the FromFile once, in the constructor.
After, like with a timer, i have my picturebox set to visible = false or
true, just like a blinking if you want.
Then, after a couple of minutes of blinking, i have the "already in use"
message (and the gif loaded in the picturebox is replaced with a red cross
with blank background..)

Do i have to do a FromFile then a Dispose instead of a Visible =
true/false ?

Thanks.


Mar 19 '07 #4
Bob
Thanks, the problem is solved, using dispose.
Mar 20 '07 #5

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

Similar topics

1
3113
by: Charlie | last post by:
Hi I am using the following code to create an image viewer for multiple images. var pageImage = document.images; var image = new Image(); var args = GetQuerystring(); //return arguments from querystring image.src = args.imageSource; //get image src pageImage.src = ""; pageImage.src = image.src;
0
1709
by: BATISTA | last post by:
Hi I have to program in C# such that I have to add a button to the form , and create a crystal report, by getting source from the xml schema file(.xsd file) with two fields namely name,image..... name is string datatype and image is of datatype base64Binary. Now i have to add a crystal report viewer to the form and whenthe program is run, we should be able to load any image ,ie, by clicking the button add any image from the disk and...
12
6194
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small console application in C++ (unmanaged) that uses the DLL above. Now the application, together with the above DLL’s is successfully loading a TIF image file (62992 x 113386 Pixels, Huffman RLE compression, 3200 x 3200 DPI resolution, binary colored (1 Bit Per Pixel), file on disk size 43.08...
3
4393
by: Mike Dee | last post by:
Hi, I'm having an issue with the status bar in Mozilla and Netscape showing that it is still waiting on the page to load even after it is finished. This problem does NOT occur with IE. In summary, I am using a onLoad event in the BODY tag to communicate back to another server each time a page finishes loading. I do this by using a "new Image()" and setting the .src property to the server. The .src includes a value in the querystring...
4
3673
by: jordi_ramis | last post by:
Hi, I'm currently using image.fromfile to load jpg images in my application. I've noted that this procedure is very slow compared to some aplications I have seen. Is there any way to load a jpeg image into an image or bitmap object faster that image.fromfile?. Prefereably one method or component that is free. Thanks a lot for your help.
1
3831
by: dbagirltx | last post by:
We have done some testing with mixed and forgotten results. So I'm hoping that asking here can clarify some issues for us. Right now we do one weekly warm backup. Throughout the week there are multiple unrecoverable loads. We are tyring to come up with the best backup strategy for this system? It is a large dev data warehouse. What happens when a table is loaded unrecoverable and then we need to restore (no DDL has been done)? Can we...
6
2735
by: nuhura01 | last post by:
Hi all... My system contains an image which I have saved it at client side. Unfortunately, when users want to view the image, the image doesn't loaded. If i'm not mistaken, it is set at the HTML code of asp.net web form right? I've set the Image URL to be like this: ImageUrl="C:\ExportImage.gif". I don't want to create a new file for placing the image since other clients who don't have the file might not be able to access the image.
11
3718
by: Chamnap | last post by:
Hello, I have several images that need to be loaded dynamically based on user interaction. Each image size is about 6000x1500 pixels. I see several sites they make the image blur, blur, blur, and the image become clear. I want to know how to do this, or maybe you all have other solutions better than this. Can anyone give me some suggestions and the way how to implement? Thanks
2
3746
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map, ..well now I want to load in icons(images) instead of text. (yes i'm being difficult) and i'd like the text to load into a static placeholder symbol instead. Problem is, I can get images to load in a separate file, text to load in a separate file, and text to appear in a static...
2
2801
by: Casey | last post by:
I'm doing some image processing that requires accessing the individual pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of pixel RGB tuples using the Image class instance load() method. Unfortunately, I can't seem to find a reciprocal function that converts the 2D array of RGB tuples back to an image. I've gone through all of the online documentation and can't seem to find what should be an obvious solution. Any...
0
9734
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
10397
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
10413
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
10138
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9214
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
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5565
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...
1
4353
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
2
3879
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.