Software testing if TImage was assigned in the form

My program has a TImage component in a form.

In some situation, the program should check:

If "there is an image assigned to the TImage component's image property" then .............

How can i do this?

Thanks in advance.

+2


a source to share


3 answers


if Image.Picture.Bitmap.Empty then DoStuff



+1


a source


Better late than never! The right way:



if Assigned(Image1.Picture.Graphic) then ...

+1


a source


You are not talking, but I am assuming that you are talking about Delphi.

You can check if there is a bitmap in the TImage control by testing:

if Image.Picture.Bitmap.Width > 0 then
  // do whatever

      

0


a source







All Articles