On Sep 28, 2006, at 11:53 PM, Peter Bozek wrote:

On 9/29/06, CV <[EMAIL PROTECTED]> wrote:

> dim aContainer a MyContainer
>
> aContainer = New MyContainer
> aContainer.Initialize
> aContainer.Show  // this line does not seem to have any effect on
> aContainer.DrawInto (g,0,0)
>
> but nothing is drawn. It seems that Paint method of objects in
> Container is not called at all.

Do you want to embed a ContainerControl on a canvas or window during
runtime? If so, check out the EmbedWithin command. That would be the
runtime equivalent of "put it into window" as you mention above.

Or is your objective something else?


Yes, I would like to draw the container to window many times. I could
create many containers and embed them in a window, but it seemed to me
that using one container and  drawing it into the Window would be
easier. As Container is a child of Window and support DrawInto, this
should work - I wanted to know if I am doing something wrong or there
is some problem with Drawinto.

So you are just drawing; you want images of controls, not functioning controls? OK...

If that is the case then just draw your ContainerControl into a Picture object and DrawPict the picture where you want it. From a pushbutton your code would look more like this:

dim p as picture = NewPicture (ContainerControl11.width,ContainerControl11.height,32)
  dim g as Graphics = p.Graphics
  ContainerControl11.DrawInto p.Graphics, 0, 0
  self.Canvas1.Graphics.DrawPicture p, 0, 0

DrawInto is not perfect, so you may see some issues there depending on what controls you have in your ContainerControl. Also, as with any type of drawing, you will have the usual issues of maintaining your image. To handle that, create a window property to hold your picture, then DrawPicture that property in Canvas_Paint as well.

Best,

Jack




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to