473,729 Members | 2,150 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2672
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****@discuss ions.microsoft. comwrote in message
news:4C******** *************** ***********@mic rosoft.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******** ********@TK2MSF TNGP02.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****@discuss ions.microsoft. comwrote in message
news:4C******** *************** ***********@mic rosoft.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******** ********@TK2MSF TNGP02.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****@discuss ions.microsoft. comwrote in message
news:4C******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comwrote in message
news:62******** *************** ***********@mic rosoft.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******** ********@TK2MSF TNGP02.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****@discuss ions.microsoft. comwrote in message
news:4C******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comwrote in message
news:62******** *************** ***********@mic rosoft.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******** ********@TK2MSF TNGP02.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****@discuss ions.microsoft. comwrote in message
news:4C******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comwrote in message
news:86******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comwrote in message
news:62******** *************** ***********@mic rosoft.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******** ********@TK2MSF TNGP02.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****@discuss ions.microsoft. comwrote in message
news:4C******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comwrote in message
news:86******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comwrote in message
news:62******** *************** ***********@mic rosoft.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******** ********@TK2MSF TNGP02.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****@discuss ions.microsoft. comwrote in message
news:4C******** *************** ***********@mic rosoft.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
2899
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
1251
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 autoredraw redraw automaticaly au paint on a picturebox )
61
16263
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 simulation - display registers contents I tried to search con google with no success.
4
5173
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. But can we simulate a button click instead? This way if later the delegate is changed for the button, we don't forget to do the changes on other events?
1
8010
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 picture box this property?
1
2219
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 found the following possibilities to simulate it: 1) Use SendInput Function (user32.dll) (unmanaged code) 2) Use System.Windows.Forms.SendKeys (managed code)
0
1117
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 to another image to use for repainting. any ideas how i can do this from the background worker, that will be available in the main thread? i've tried using invalidate, update + refresh. invalidate + refresh just clear the picture box. is there a...
1
3043
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 "Santiago/Chile" which is GMT-04, but for to execute a few lines of code that demand time zone "GMT 0" i need to change or simulate de time zone "GMT 0" how can i do that?
2
5691
by: Jerry West | last post by:
Is there a comparable .NET function for the VB6 Form's .AutoRedraw function? JW
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9280
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8144
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.