473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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 7318
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$*************@TK2MSFTNGP06.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**************@TK2MSFTNGP04.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
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...
0
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...
12
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...
3
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...
4
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...
1
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...
6
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...
11
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,...
2
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...
2
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()...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.