Wednesday, March 18, 2020
How to Clear the Graphics in a TImage Control
How to Clear the Graphics in a TImage Control 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 TPictures 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, youll 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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.