I’m using two bitmaps to draw graphs on them. After drawing I need to show bitmap pictures in two Images. Assigning bitmap to Image or drawing bitmap to Image sometimes causes Image to disappear (you can see form background).
I have tried this:
Image->Picture->Bitmap->Assign(bitmap1);
Image2->Picture->Bitmap->Assign(bitmap2);
Image->Picture->Graphic = bitmap1;....
Image->Canvas->Draw(0,0,bitmap1);....
Image->Picture->Bitmap->Canvas->Draw(0,0,bitmap1);
If I don’t have Sleep(100) between Image and Image2 redrawing, Image2 isn’t visible for the most of the time. Also adding Image2->Refresh helps, but the issue still sometimes occurs to both Images.
If I save created bitmaps or Images to .jpeg files, all .jpeg images are correct and none of them are empty. Also Image->height, Image->picture->bitmap->height and width is always correct.
Can anyone tell me, what I’m doing wrong?
After a while I realised, that bitmaps and Images, which I saved, weren’t all correct. If I was unable to see picture, it wasn’t fully drawn. There were no errors, it occurred randomly, but I found out, that once program started to ignore my drawing commands, it didn’t draw anything until the end of the function, which does drawing.
So – to check, if I can still draw, before assigning bitmap to Image, I did this:
It means – I changed one pixel red, and after that printed over text, which should make that changed pixel white. Based on that I checked, if the color changed (was able to change pixel color and print text).
I really don’t know reason, why it sometimes starts to ignore drawing commands, but I hope, that if someone runs into the same issue as I did, this answer might help him/her.