Science, Tech, Math › Computer Science How to Clear the Graphics in a TImage Control A short Delphi code block saves the day Share Flipboard Email Print Teresa Short/Getty Images Computer Science Delphi Programming Delphi Tutorials Advanced PHP Programming Perl Python Java Programming Javascript Programming C & C++ Programming Ruby Programming Visual Basic View More By Zarko Gajic Zarko Gajic Twitter Computer Science Expert MSCS, Computer Science, University of Osijek Zarko Gajic is experienced in SQL and has working knowledge of DB systems such as MS SQL Server, Firebird, Interbase, and Oracle. He is also proficient in XML, DHTML, and JavaScript. Learn about our Editorial Process Updated on March 10, 2019 Delphi programmers use the TImage control to display an image. These are files that end in extensions including ICO, BMP, WMF, WMF, GIF, and JPG. The Picture property specifies the image that appears in the TImage control. Delphi supports several different methods for assigning an image for the TImage component: a TPicture's method LoadFromFile reads graphics from disk or the Assign method obtains the image from Clipboard, for example. In the absence of a direct command to clear the Picture property, you'll need to assign a "nil" object to it. Doing so essentially blanks the image. For a TImage control named Photo, use either of two methods to clear the assigned graphic: {code:delphi}Photo.Picture := nil;{code} or: {code:delphi}Photo.Picture.Assign(nil);{code} Either code block will clear the picture from your TImage control. The first approach asserts a nil value to the Picture property; the second approach assigns a nil through the use of a method. Cite this Article Format mla apa chicago Your Citation Gajic, Zarko. "How to Clear the Graphics in a TImage Control." ThoughtCo, Feb. 16, 2021, thoughtco.com/clear-the-graphics-in-timage-control-1057545. Gajic, Zarko. (2021, February 16). How to Clear the Graphics in a TImage Control. Retrieved from https://www.thoughtco.com/clear-the-graphics-in-timage-control-1057545 Gajic, Zarko. "How to Clear the Graphics in a TImage Control." ThoughtCo. https://www.thoughtco.com/clear-the-graphics-in-timage-control-1057545 (accessed April 2, 2023). copy citation