Strange EAccessViolation when loading a Bitmap
Posted on 2001-08-21
I have to handle two bitmaps, one in a visual component and another, smaller one, in memory to be drawn into the first to specific positions. Every time I try to assign a bitmap to the memory-held BitMap the program gets an EAccessViolation. I tried to save and load the data, but here again the EAccessViolation when loading it to the variable.
Is there something I have to do with the Pixmap before loading an image to it? If I understood the help tables correctly, LoadFromFile should do the whole bunch of creating, defining the size, allocating memory and so on.
procedure TAnimation.LoadSign(Sender: TObject);
if FileExists(SignBrightName) then
Sign.VisModel^.Pixmap.LoadFromFile(SignBrightName) //<--------crash with EAccessViolation
Sign is of type TSignDef which holds the data for defining the sign in the scene, Sign.VisModel is a pointer to type TSignModel, which holds the data needed to display the sign on the screen. Sign.VisModel is created when showing the form to enter the data, if it's not already existing.