I have a viewer with a canvas that is locked on 4 sides; changing the window changes the format. The canvas has a scaling method. No problem. But when the user maximizes the window I want 2 canvases to show up next to each other. I’ve tried to make the 2nd canvas invisible, when the maximize event fires it becomes visible and positions itself next to the 1st canvas but I cannot get it right. It won’t show up correct; overlaps and size problems.
I just tried this on OSX and it appears that “self.width” in the Maximize event is the width before maximizing, not after. That seems unintuitive. Could you put your code in the resized event instead, which would then have the correct window width? You could check to see if width>height or something like that to determine if you should show 2 versus 1 canvas, or set up a variable that gets set in the Maximize event…
You might also need to unlock the right side of viewerCanvas1. Are both canvases directly on the window, or are they in a container control or other object?
After the corrections of Chris, there is no problem with the positioning on my Windows 8.1 system, but after resizing Rectangle3 loses it’s fillcolor. Even if i insert a refresh after the resizing the fillcolor is still gone.
After removing all the code out of the resized event everything works fine, strange, very strange effect.
Besides the corrections of Chris you should also remove the " if PagePanel1.Value = 1 then" condition because the resize can also happen when the PagePanel1.Value = 0 and then you also want the picture in both views being adjusted to the new size.
Further you used in resize and resized events integer division (\) and floating division (/), this can cause rounding differeneces, because you are dealing with integer values IMO you should use “”.
Slight mishap with the forum just then, I posted a reply, it suddenly came up again as a double-post, so I deleted the 2nd one and now both have gone ! - so a repost…
I think Andrew’s issue is probably not correcting all the rectangle references, ie:
[quote=74535:@Andre Kuiper]After removing all the code out of the resized event everything works fine, strange, very strange effect.
Besides the corrections of Chris you should also remove the " if PagePanel1.Value = 1 then" condition because the resize can also happen when the PagePanel1.Value = 0 and then you also want the picture in both views being adjusted to the new size.
Further you used in resize and resized events integer division (\) and floating division (/), this can cause rounding differeneces, because you are dealing with integer values IMO you should use “”.
HTH,
Andre[/quote]
Hi André,
I followed your directions and it looks like it is ok!