Click here to Skip to main content
15,916,945 members
Home / Discussions / C#
   

C#

 
QuestionOverwrite an image after unload it from a picture box control Pin
t800t810-Jan-06 17:16
t800t810-Jan-06 17:16 
AnswerRe: Overwrite an image after unload it from a picture box control Pin
Christian Graus10-Jan-06 17:38
protectorChristian Graus10-Jan-06 17:38 
GeneralRe: Overwrite an image after unload it from a picture box control Pin
t800t810-Jan-06 17:58
t800t810-Jan-06 17:58 
GeneralRe: Overwrite an image after unload it from a picture box control Pin
Christian Graus10-Jan-06 17:59
protectorChristian Graus10-Jan-06 17:59 
GeneralRe: Overwrite an image after unload it from a picture box control Pin
t800t810-Jan-06 18:01
t800t810-Jan-06 18:01 
GeneralRe: Overwrite an image after unload it from a picture box control Pin
Christian Graus10-Jan-06 18:02
protectorChristian Graus10-Jan-06 18:02 
GeneralRe: Overwrite an image after unload it from a picture box control Pin
t800t810-Jan-06 18:14
t800t810-Jan-06 18:14 
GeneralRe: Overwrite an image after unload it from a picture box control Pin
Dave Kreskowiak11-Jan-06 5:23
mveDave Kreskowiak11-Jan-06 5:23 
The Bitmap class inherits from Image and uses Image's FromFile method, which calls a GDI+ Flat API function in GDIPlus.dll (curiously, something you're NOT supposed to do), called GdipLoadImageFromFile to load the image file. It looks like the resulting file handle is never closed so long as the GDI+ Image object exists.

As you probably know, the usual workaround was this[^] little article on MSDN. This eventually uses the GdipLoadImageFromStream GDI+ function, which does not hold a handle to the original image stream.

In 2005, the PictureBox.Load method calls the static Image.FromStream method, no matter what the actual source of the image is, so locking the image file is not a problem.


But, to answer his question, PictureBox.Image = null; should work no problem. I didn't have any at least... Wink | ;)


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

Questionhow to resolve overlapped region Pin
s o v a n n10-Jan-06 14:37
s o v a n n10-Jan-06 14:37 
AnswerRe: how to resolve overlapped region Pin
Christian Graus10-Jan-06 14:53
protectorChristian Graus10-Jan-06 14:53 
GeneralRe: how to resolve overlapped region Pin
s o v a n n10-Jan-06 16:07
s o v a n n10-Jan-06 16:07 
GeneralRe: how to resolve overlapped region Pin
Christian Graus10-Jan-06 16:09
protectorChristian Graus10-Jan-06 16:09 
QuestionTest for Scroll Lock State Pin
dmbrider10-Jan-06 14:13
dmbrider10-Jan-06 14:13 
AnswerRe: Test for Scroll Lock State Pin
Curtis Schlak.10-Jan-06 15:57
Curtis Schlak.10-Jan-06 15:57 
GeneralRe: Test for Scroll Lock State Pin
dmbrider11-Jan-06 2:56
dmbrider11-Jan-06 2:56 
Questionmime handling with webbrowser control Pin
abnopanda10-Jan-06 13:24
abnopanda10-Jan-06 13:24 
AnswerRe: mime handling with webbrowser control Pin
leppie10-Jan-06 18:51
leppie10-Jan-06 18:51 
AnswerRe: mime handling with webbrowser control Pin
mitooki12-Jan-06 3:51
mitooki12-Jan-06 3:51 
GeneralRe: mime handling with webbrowser control Pin
abnopanda12-Jan-06 8:17
abnopanda12-Jan-06 8:17 
GeneralRe: mime handling with webbrowser control Pin
mitooki12-Jan-06 23:54
mitooki12-Jan-06 23:54 
QuestionReseting the text in a control. Pin
DELETEUSER10-Jan-06 11:22
DELETEUSER10-Jan-06 11:22 
AnswerRe: Reseting the text in a control. Pin
Christian Graus10-Jan-06 12:10
protectorChristian Graus10-Jan-06 12:10 
AnswerRe: Reseting the text in a control. Pin
Guffa10-Jan-06 13:59
Guffa10-Jan-06 13:59 
QuestionResponding to a click on a Shockwave object. Pin
jbradshaw10-Jan-06 10:35
jbradshaw10-Jan-06 10:35 
AnswerRe: Responding to a click on a Shockwave object. Pin
mitooki11-Jan-06 1:09
mitooki11-Jan-06 1:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.