Home All Groups Group Topic Archive Search About
Author
25 Sep 2006 11:49 PM
Doug Marquardt
Hi All:

I want to simulate VB6 Autoredraw in VB.Net

I figure I would probably have to create a memory dc,
paint to that, and then create a bitmap based on the dc
and copy that image into a bitmap,
and then assign that to the image property of my control?

If so, then can  someone push me in the right direction
to get started on this.

If not, then what would you suggest.

Thanks.

Doug.

Author
26 Sep 2006 12:41 AM
Dennis
Just create a bitmap that's persistent.  You can then create a graphics
object from it and draw on the bitmap.  In the paint event, you can use
bitblt to copy the bitmap to your form, picture box, or whatever.  I have an
example if you like.
--
Dennis in Houston


Show quoteHide quote
"Doug Marquardt" wrote:

> Hi All:
>
> I want to simulate VB6 Autoredraw in VB.Net
>
> I figure I would probably have to create a memory dc,
> paint to that, and then create a bitmap based on the dc
>  and copy that image into a bitmap,
> and then assign that to the image property of my control?
>
> If so, then can  someone push me in the right direction
> to get started on this.
>
> If not, then what would you suggest.
>
> Thanks.
>
> Doug.
>
>
>
Author
26 Sep 2006 1:30 AM
Doug Marquardt
Hi Dennis:

That was the first thing I looked at, but I couldn't
figure out how to draw to the bitmap (the only
method I saw was for setting pixels).

So how do you draw to the bitmap?

Doug.

Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> wrote in message
news:4CEAC020-1D11-4686-937B-280B6AAF7009@microsoft.com...
> Just create a bitmap that's persistent.  You can then create a graphics
> object from it and draw on the bitmap.  In the paint event, you can use
> bitblt to copy the bitmap to your form, picture box, or whatever.  I have
an
> example if you like.
> --
> Dennis in Houston
>
>
> "Doug Marquardt" wrote:
>
> > Hi All:
> >
> > I want to simulate VB6 Autoredraw in VB.Net
> >
> > I figure I would probably have to create a memory dc,
> > paint to that, and then create a bitmap based on the dc
> >  and copy that image into a bitmap,
> > and then assign that to the image property of my control?
> >
> > If so, then can  someone push me in the right direction
> > to get started on this.
> >
> > If not, then what would you suggest.
> >
> > Thanks.
> >
> > Doug.
> >
> >
> >
Author
26 Sep 2006 2:20 AM
Doug Marquardt
Hi Dennis:

I was able to figure out to create the graphics from the bitmap,
and was able to draw to it, etc.
Assigning the bitmap to the image property seems to work fine...
what advantages would there be to bitblt in the paint event?

Doug.



Show quoteHide quote
"Doug Marquardt" <no_spam@dummy.com> wrote in message
news:%23IgjOtQ4GHA.3444@TK2MSFTNGP02.phx.gbl...
> Hi Dennis:
>
> That was the first thing I looked at, but I couldn't
> figure out how to draw to the bitmap (the only
> method I saw was for setting pixels).
>
> So how do you draw to the bitmap?
>
> Doug.
>
> "Dennis" <Den***@discussions.microsoft.com> wrote in message
> news:4CEAC020-1D11-4686-937B-280B6AAF7009@microsoft.com...
> > Just create a bitmap that's persistent.  You can then create a graphics
> > object from it and draw on the bitmap.  In the paint event, you can use
> > bitblt to copy the bitmap to your form, picture box, or whatever.  I
have
> an
> > example if you like.
> > --
> > Dennis in Houston
> >
> >
> > "Doug Marquardt" wrote:
> >
> > > Hi All:
> > >
> > > I want to simulate VB6 Autoredraw in VB.Net
> > >
> > > I figure I would probably have to create a memory dc,
> > > paint to that, and then create a bitmap based on the dc
> > >  and copy that image into a bitmap,
> > > and then assign that to the image property of my control?
> > >
> > > If so, then can  someone push me in the right direction
> > > to get started on this.
> > >
> > > If not, then what would you suggest.
> > >
> > > Thanks.
> > >
> > > Doug.
> > >
> > >
> > >
>
>
Author
26 Sep 2006 10:40 PM
Dennis
I think it may be a bit quicker.
--
Dennis in Houston


Show quoteHide quote
"Doug Marquardt" wrote:

> Hi Dennis:
>
> I was able to figure out to create the graphics from the bitmap,
> and was able to draw to it, etc.
> Assigning the bitmap to the image property seems to work fine...
> what advantages would there be to bitblt in the paint event?
>
> Doug.
>
>
>
> "Doug Marquardt" <no_spam@dummy.com> wrote in message
> news:%23IgjOtQ4GHA.3444@TK2MSFTNGP02.phx.gbl...
> > Hi Dennis:
> >
> > That was the first thing I looked at, but I couldn't
> > figure out how to draw to the bitmap (the only
> > method I saw was for setting pixels).
> >
> > So how do you draw to the bitmap?
> >
> > Doug.
> >
> > "Dennis" <Den***@discussions.microsoft.com> wrote in message
> > news:4CEAC020-1D11-4686-937B-280B6AAF7009@microsoft.com...
> > > Just create a bitmap that's persistent.  You can then create a graphics
> > > object from it and draw on the bitmap.  In the paint event, you can use
> > > bitblt to copy the bitmap to your form, picture box, or whatever.  I
> have
> > an
> > > example if you like.
> > > --
> > > Dennis in Houston
> > >
> > >
> > > "Doug Marquardt" wrote:
> > >
> > > > Hi All:
> > > >
> > > > I want to simulate VB6 Autoredraw in VB.Net
> > > >
> > > > I figure I would probably have to create a memory dc,
> > > > paint to that, and then create a bitmap based on the dc
> > > >  and copy that image into a bitmap,
> > > > and then assign that to the image property of my control?
> > > >
> > > > If so, then can  someone push me in the right direction
> > > > to get started on this.
> > > >
> > > > If not, then what would you suggest.
> > > >
> > > > Thanks.
> > > >
> > > > Doug.
> > > >
> > > >
> > > >
> >
> >
>
>
>
Author
27 Sep 2006 4:43 AM
Doug Marquardt
Hi Dennis:

Pardon my ignorance  here...
but I really don't see how bitblt in the paint event
could be quicker than assigning the bitmap
to the image -- the point being that once I assign
the image the control takes over all the painting, etc.???

Just curious...

Doug.


Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> wrote in message
news:62E328B6-D10B-406B-AE2A-A233D041A012@microsoft.com...
> I think it may be a bit quicker.
> --
> Dennis in Houston
>
>
> "Doug Marquardt" wrote:
>
> > Hi Dennis:
> >
> > I was able to figure out to create the graphics from the bitmap,
> > and was able to draw to it, etc.
> > Assigning the bitmap to the image property seems to work fine...
> > what advantages would there be to bitblt in the paint event?
> >
> > Doug.
> >
> >
> >
> > "Doug Marquardt" <no_spam@dummy.com> wrote in message
> > news:%23IgjOtQ4GHA.3444@TK2MSFTNGP02.phx.gbl...
> > > Hi Dennis:
> > >
> > > That was the first thing I looked at, but I couldn't
> > > figure out how to draw to the bitmap (the only
> > > method I saw was for setting pixels).
> > >
> > > So how do you draw to the bitmap?
> > >
> > > Doug.
> > >
> > > "Dennis" <Den***@discussions.microsoft.com> wrote in message
> > > news:4CEAC020-1D11-4686-937B-280B6AAF7009@microsoft.com...
> > > > Just create a bitmap that's persistent.  You can then create a
graphics
> > > > object from it and draw on the bitmap.  In the paint event, you can
use
> > > > bitblt to copy the bitmap to your form, picture box, or whatever.  I
> > have
> > > an
> > > > example if you like.
> > > > --
> > > > Dennis in Houston
> > > >
> > > >
> > > > "Doug Marquardt" wrote:
> > > >
> > > > > Hi All:
> > > > >
> > > > > I want to simulate VB6 Autoredraw in VB.Net
> > > > >
> > > > > I figure I would probably have to create a memory dc,
> > > > > paint to that, and then create a bitmap based on the dc
> > > > >  and copy that image into a bitmap,
> > > > > and then assign that to the image property of my control?
> > > > >
> > > > > If so, then can  someone push me in the right direction
> > > > > to get started on this.
> > > > >
> > > > > If not, then what would you suggest.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Doug.
> > > > >
> > > > >
> > > > >
> > >
> > >
> >
> >
> >
Author
27 Sep 2006 11:12 PM
Dennis
Use whatever you want.   I personally use the bitblt and it's ligntning
quick.  I would think that an image has to be rendered during each paint
event from a general format and copied to the picturebox or whatever.  In VB6
and before, I think controls had the option of having their background
persistent in memory and didn't have to be redarwn to the picturebox, etc.
each time it was repainted.  However, in VB.Net this changed so the image has
to be copied to the picturebox during each paint event.

--
Dennis in Houston


Show quoteHide quote
"Doug Marquardt" wrote:

> Hi Dennis:
>
> Pardon my ignorance  here...
> but I really don't see how bitblt in the paint event
> could be quicker than assigning the bitmap
> to the image -- the point being that once I assign
> the image the control takes over all the painting, etc.???
>
> Just curious...
>
> Doug.
>
>
> "Dennis" <Den***@discussions.microsoft.com> wrote in message
> news:62E328B6-D10B-406B-AE2A-A233D041A012@microsoft.com...
> > I think it may be a bit quicker.
> > --
> > Dennis in Houston
> >
> >
> > "Doug Marquardt" wrote:
> >
> > > Hi Dennis:
> > >
> > > I was able to figure out to create the graphics from the bitmap,
> > > and was able to draw to it, etc.
> > > Assigning the bitmap to the image property seems to work fine...
> > > what advantages would there be to bitblt in the paint event?
> > >
> > > Doug.
> > >
> > >
> > >
> > > "Doug Marquardt" <no_spam@dummy.com> wrote in message
> > > news:%23IgjOtQ4GHA.3444@TK2MSFTNGP02.phx.gbl...
> > > > Hi Dennis:
> > > >
> > > > That was the first thing I looked at, but I couldn't
> > > > figure out how to draw to the bitmap (the only
> > > > method I saw was for setting pixels).
> > > >
> > > > So how do you draw to the bitmap?
> > > >
> > > > Doug.
> > > >
> > > > "Dennis" <Den***@discussions.microsoft.com> wrote in message
> > > > news:4CEAC020-1D11-4686-937B-280B6AAF7009@microsoft.com...
> > > > > Just create a bitmap that's persistent.  You can then create a
> graphics
> > > > > object from it and draw on the bitmap.  In the paint event, you can
> use
> > > > > bitblt to copy the bitmap to your form, picture box, or whatever.  I
> > > have
> > > > an
> > > > > example if you like.
> > > > > --
> > > > > Dennis in Houston
> > > > >
> > > > >
> > > > > "Doug Marquardt" wrote:
> > > > >
> > > > > > Hi All:
> > > > > >
> > > > > > I want to simulate VB6 Autoredraw in VB.Net
> > > > > >
> > > > > > I figure I would probably have to create a memory dc,
> > > > > > paint to that, and then create a bitmap based on the dc
> > > > > >  and copy that image into a bitmap,
> > > > > > and then assign that to the image property of my control?
> > > > > >
> > > > > > If so, then can  someone push me in the right direction
> > > > > > to get started on this.
> > > > > >
> > > > > > If not, then what would you suggest.
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > Doug.
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > >
> > >
> > >
>
>
>
Author
28 Sep 2006 10:41 PM
Doug Marquardt
Hi Dennis:

Not sure what you mean by "copied to the picturebox during each paint
event"...
as I only have to assign the bitmap to the control image property and forget
about it.  Are you saying that internally, vb.net has to copy/render any
image
each time the paint event is fired?

In any case, what I am doing now works just fine and I do not notice
any performance issues whatsoever.

Thanks for getting me started on the right path with this.

Doug.


Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> wrote in message
news:86A3BFD8-7C73-4BCF-B390-21234E46856A@microsoft.com...
> Use whatever you want.   I personally use the bitblt and it's ligntning
> quick.  I would think that an image has to be rendered during each paint
> event from a general format and copied to the picturebox or whatever.  In
VB6
> and before, I think controls had the option of having their background
> persistent in memory and didn't have to be redarwn to the picturebox, etc.
> each time it was repainted.  However, in VB.Net this changed so the image
has
> to be copied to the picturebox during each paint event.
>
> --
> Dennis in Houston
>
>
> "Doug Marquardt" wrote:
>
> > Hi Dennis:
> >
> > Pardon my ignorance  here...
> > but I really don't see how bitblt in the paint event
> > could be quicker than assigning the bitmap
> > to the image -- the point being that once I assign
> > the image the control takes over all the painting, etc.???
> >
> > Just curious...
> >
> > Doug.
> >
> >
> > "Dennis" <Den***@discussions.microsoft.com> wrote in message
> > news:62E328B6-D10B-406B-AE2A-A233D041A012@microsoft.com...
> > > I think it may be a bit quicker.
> > > --
> > > Dennis in Houston
> > >
> > >
> > > "Doug Marquardt" wrote:
> > >
> > > > Hi Dennis:
> > > >
> > > > I was able to figure out to create the graphics from the bitmap,
> > > > and was able to draw to it, etc.
> > > > Assigning the bitmap to the image property seems to work fine...
> > > > what advantages would there be to bitblt in the paint event?
> > > >
> > > > Doug.
> > > >
> > > >
> > > >
> > > > "Doug Marquardt" <no_spam@dummy.com> wrote in message
> > > > news:%23IgjOtQ4GHA.3444@TK2MSFTNGP02.phx.gbl...
> > > > > Hi Dennis:
> > > > >
> > > > > That was the first thing I looked at, but I couldn't
> > > > > figure out how to draw to the bitmap (the only
> > > > > method I saw was for setting pixels).
> > > > >
> > > > > So how do you draw to the bitmap?
> > > > >
> > > > > Doug.
> > > > >
> > > > > "Dennis" <Den***@discussions.microsoft.com> wrote in message
> > > > > news:4CEAC020-1D11-4686-937B-280B6AAF7009@microsoft.com...
> > > > > > Just create a bitmap that's persistent.  You can then create a
> > graphics
> > > > > > object from it and draw on the bitmap.  In the paint event, you
can
> > use
> > > > > > bitblt to copy the bitmap to your form, picture box, or
whatever.  I
Show quoteHide quote
> > > > have
> > > > > an
> > > > > > example if you like.
> > > > > > --
> > > > > > Dennis in Houston
> > > > > >
> > > > > >
> > > > > > "Doug Marquardt" wrote:
> > > > > >
> > > > > > > Hi All:
> > > > > > >
> > > > > > > I want to simulate VB6 Autoredraw in VB.Net
> > > > > > >
> > > > > > > I figure I would probably have to create a memory dc,
> > > > > > > paint to that, and then create a bitmap based on the dc
> > > > > > >  and copy that image into a bitmap,
> > > > > > > and then assign that to the image property of my control?
> > > > > > >
> > > > > > > If so, then can  someone push me in the right direction
> > > > > > > to get started on this.
> > > > > > >
> > > > > > > If not, then what would you suggest.
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > Doug.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> >
> >
> >
Author
28 Sep 2006 11:01 PM
Dennis
Yes, that's what I mean.  I could be wrong but from what I've read, each
paint event requires the image to be copied to the picturebox or at least
that part of it that needs to be redrawn.  The picturebox is not displayed
from a persistent area of memory.  Maybe someone on this newsgroup can
explain if I'm wrong or explain it better.
--
Dennis in Houston


Show quoteHide quote
"Doug Marquardt" wrote:

> Hi Dennis:
>
> Not sure what you mean by "copied to the picturebox during each paint
> event"...
> as I only have to assign the bitmap to the control image property and forget
> about it.  Are you saying that internally, vb.net has to copy/render any
> image
> each time the paint event is fired?
>
> In any case, what I am doing now works just fine and I do not notice
> any performance issues whatsoever.
>
> Thanks for getting me started on the right path with this.
>
> Doug.
>
>
> "Dennis" <Den***@discussions.microsoft.com> wrote in message
> news:86A3BFD8-7C73-4BCF-B390-21234E46856A@microsoft.com...
> > Use whatever you want.   I personally use the bitblt and it's ligntning
> > quick.  I would think that an image has to be rendered during each paint
> > event from a general format and copied to the picturebox or whatever.  In
> VB6
> > and before, I think controls had the option of having their background
> > persistent in memory and didn't have to be redarwn to the picturebox, etc.
> > each time it was repainted.  However, in VB.Net this changed so the image
> has
> > to be copied to the picturebox during each paint event.
> >
> > --
> > Dennis in Houston
> >
> >
> > "Doug Marquardt" wrote:
> >
> > > Hi Dennis:
> > >
> > > Pardon my ignorance  here...
> > > but I really don't see how bitblt in the paint event
> > > could be quicker than assigning the bitmap
> > > to the image -- the point being that once I assign
> > > the image the control takes over all the painting, etc.???
> > >
> > > Just curious...
> > >
> > > Doug.
> > >
> > >
> > > "Dennis" <Den***@discussions.microsoft.com> wrote in message
> > > news:62E328B6-D10B-406B-AE2A-A233D041A012@microsoft.com...
> > > > I think it may be a bit quicker.
> > > > --
> > > > Dennis in Houston
> > > >
> > > >
> > > > "Doug Marquardt" wrote:
> > > >
> > > > > Hi Dennis:
> > > > >
> > > > > I was able to figure out to create the graphics from the bitmap,
> > > > > and was able to draw to it, etc.
> > > > > Assigning the bitmap to the image property seems to work fine...
> > > > > what advantages would there be to bitblt in the paint event?
> > > > >
> > > > > Doug.
> > > > >
> > > > >
> > > > >
> > > > > "Doug Marquardt" <no_spam@dummy.com> wrote in message
> > > > > news:%23IgjOtQ4GHA.3444@TK2MSFTNGP02.phx.gbl...
> > > > > > Hi Dennis:
> > > > > >
> > > > > > That was the first thing I looked at, but I couldn't
> > > > > > figure out how to draw to the bitmap (the only
> > > > > > method I saw was for setting pixels).
> > > > > >
> > > > > > So how do you draw to the bitmap?
> > > > > >
> > > > > > Doug.
> > > > > >
> > > > > > "Dennis" <Den***@discussions.microsoft.com> wrote in message
> > > > > > news:4CEAC020-1D11-4686-937B-280B6AAF7009@microsoft.com...
> > > > > > > Just create a bitmap that's persistent.  You can then create a
> > > graphics
> > > > > > > object from it and draw on the bitmap.  In the paint event, you
> can
> > > use
> > > > > > > bitblt to copy the bitmap to your form, picture box, or
> whatever.  I
> > > > > have
> > > > > > an
> > > > > > > example if you like.
> > > > > > > --
> > > > > > > Dennis in Houston
> > > > > > >
> > > > > > >
> > > > > > > "Doug Marquardt" wrote:
> > > > > > >
> > > > > > > > Hi All:
> > > > > > > >
> > > > > > > > I want to simulate VB6 Autoredraw in VB.Net
> > > > > > > >
> > > > > > > > I figure I would probably have to create a memory dc,
> > > > > > > > paint to that, and then create a bitmap based on the dc
> > > > > > > >  and copy that image into a bitmap,
> > > > > > > > and then assign that to the image property of my control?
> > > > > > > >
> > > > > > > > If so, then can  someone push me in the right direction
> > > > > > > > to get started on this.
> > > > > > > >
> > > > > > > > If not, then what would you suggest.
> > > > > > > >
> > > > > > > > Thanks.
> > > > > > > >
> > > > > > > > Doug.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>
>