This is rather hard and lengthly to explain and maybe even harder to comphrehend so in advance I understand if no one wants to tackle it. Before I mention the problem that I have, I'd like to detail some background info. On my form I have a display window which contains a TImage into which my program loads bmps but because of various prior processes, the graphic image on any given bmp won't always be in the same place in that bmp. Sometimes it will be at the top and sometimes nearer the bottom and my program has no way of knowing beforehand where that image will be but I still need to display it centered in the TImage.
Since the background of the bmp will always be white, my solution was to make Image6.height := 0 and Image6.top := the bottom of my display window and then to gradually increase Image6.height and gradually decrease Image6.top, all the while scanning across the bmp until a pixel other than white is found. At that point, the bmp will be centered in the display window.
This technique works well and gives a very desirable and dramatic sense of motion as the bmp rises from the bottom until it's centered but if the user moves part of the display window offscreen while all of this is happening then the part of the window that's offscreen will be black, I suppose because the TImage is being stretched while it's offscreen.
What I did to correct that, of course, was to have the program automatically move the form to the top left corner of the screen while the bmp is being loaded and then to return it to its former position after the loading.
The problem with this is that the user might find it irritating to have the form moving around on its own, as I do, though I love the way the bmp rises into view.
Any suggestions for a better way to center bmp images?