I need your opinion on something I develop. I have a window where an image is shown. The image should keep it's aspect ratio and scale when the window is resized. There will also be a "Full width" mode, where the image will have 100% width and the height will respectively change, always respecting the aspect ratio. In full width mode, the window will use it's scrollbars to scroll the image.
I used a bitmap.image object in a layout, which loads and show the image, but this had a problem. When the user tried to resize the window to a smaller size, it didn't let it become smaller.
So yesterday thought to change it with a button, showing the image with a bitmap.image, because the button can be resizable, according the window. But a few problems occurred.
If I have the IA_Scalable, TRUE, the image is stretched to the whole width and height of the button. With IA_Scalable, FALSE the image is show just fine, but when I resize the window to smaller size of the images, the image is drawn above the window borders, because it doesn't actually resize itself, but keeps its original dimensions.
Also tried to catch the event of window resizing by the "WMHI_NEWSIZE", but unfortunately this doesn't work. I use a printf with a message, to see when this event is executed, but no message comes up. Is there a simple example code on how to do this?
So, I would like to ask you guys if the button solution is good for what I want to do. If not, what should I use? A backfill would be better? What do you propose about the scaling?
One more solution I thought is to use spacers, left and right of the button, and resize them while the user resizes the window. This would help to keep the button in specific WeightedWidth and calculate it's height, and also calculate, depending the image and the layout size, the width of the spacers. But to implement this it is necessary to get a window resize event while the user resizes it.
Any ideas would be more than helpful.