473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Simulate Autoredraw

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.
Sep 25 '06 #1
8 2650
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.
Sep 26 '06 #2
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" <De****@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.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.


Sep 26 '06 #3
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*****@dummy.comwrote in message
news:%2****************@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" <De****@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.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.
>
>
>


Sep 26 '06 #4
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*****@dummy.comwrote in message
news:%2****************@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" <De****@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.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.



Sep 26 '06 #5
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" <De****@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.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*****@dummy.comwrote in message
news:%2****************@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" <De****@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.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.
>
>
>
>
>

Sep 27 '06 #6
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" <De****@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.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*****@dummy.comwrote in message
news:%2****************@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" <De****@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.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.





>
>
>


Sep 27 '06 #7
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" <De****@discussions.microsoft.comwrote in message
news:86**********************************@microsof t.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" <De****@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.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*****@dummy.comwrote in message
news:%2****************@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" <De****@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.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.
>
>
>
>
>


Sep 28 '06 #8
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
"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" <De****@discussions.microsoft.comwrote in message
news:86**********************************@microsof t.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" <De****@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.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*****@dummy.comwrote in message
news:%2****************@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" <De****@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.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.





>
>
>
>
>
>


Sep 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gary | last post by:
hi, what is the change over from vb6 to vb.net in the case of picturebox1.autoredraw = true ? thanks, Gary
0
by: Derek Tremblay | last post by:
Hello every body !! i need your help in GDI+ can you help me ? (PS : sorry for my poor english) Probleme : i want simulate AutoRedraw in .NET PictureBox control (in VB6 the property...
61
by: /* frank */ | last post by:
I have to do a homework: make a CPU simulator using C language. I have a set of asm instructions so I have to write a program that should: - load .asm file - view .asm file - do a step by step...
4
by: johnny | last post by:
On a form I would like to simulate a button click when the Enter is pressed. My form is setup and it works if the delegate for the key pressed on the form calls the delegate for the button pressed....
1
by: XY | last post by:
I've noticed that neither forms nor picture boxes have the autoredraw property anymore in VB .NET. What substitute is there for it? What lines of code should i write to grant the form or the...
1
by: diegocarpintero | last post by:
I am writing a c# class which main purpose is to simulate the dialog with a GUI-application. The idea is that this class can simulate some user actions like mouse clicks on buttons. I have...
0
by: =?Utf-8?B?LnBhdWwu?= | last post by:
i've got some code that runs via a background worker on another thread. the code draws a graph to a picturebox. vb.net hasn't got an autoredraw feature, so i'm trying to draw the picturebox image...
1
by: =?Utf-8?B?UmljYXJkbyBRdWludGFuaWxsYQ==?= | last post by:
how to simulate a different time zone? ¿is it possible by code to simulate that i am in a different time zone just for to execute a few lines of code? in my case i am in the time zone...
2
by: Jerry West | last post by:
Is there a comparable .NET function for the VB6 Form's .AutoRedraw function? JW
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.