Now 'cr' contains the *real* desired size of the window. Originally, if
I specify the window should be 800x600, when it's created, that
includes all the "fluff" as well - frame, menubar (if there is one),
etc. We adjust the rectangle to compensate for this and then resize the
window so that the actual "viewport" area is proper:
int width = cr.right - cr.left + 1;
int height = cr.bottom - cr.top + 1;
Phew. Too much C. Now, I can do all of this with the UserLibrary and
all the code works, except that the SetWindowPos doesn't actually seem
to do anything. I do all of this in #onViewCreated, which could
possibly be the problem (I actually don't know the order of events in
Dolphin - in C I would do this right before ShowWindow). I've tried
using #width: and #height:, but none of these appear to actually work.
I can confirm 100% that the view is not the correct size, because
rendering a square in the viewport is not a *real* square (note: this
is rendering with Direct3D, not GDI which deals with pixels and not
Udo Schneider wrote:
> Jeff M. wrote:
> > Any helpful hints appreciated. Thanks!
> The following code snippet might help:
> presenter := ImagePresenter create: 'Gdiplus view' on: nimage.
> (presenter topShell)
> extent: (presenter topShell calcExtentFromClientExtent: nimage extent).
#calcExtentFromClientExtent was exactly what I was looking for. Thanks.
I actually got the original code to work, but it took a little
fenagling. The problem is that it appears to be an order of operations
problem. I ended up having to put the calculation in #defaultExtent,
instead of trying to resize it later (although I have no idea why).
Regardless, the method you pointed me to works, and now I have 1 line
of code where there used to be 10. Thanks. :-)