|
-
Sep 22nd, 2000, 06:22 PM
#1
Thread Starter
New Member
I'm working on a program that will do a lot of drawing to the screen. As it is, VB refreshes the screen multiple times during the drawing process. That's no good because 1: I don't want the screen to be updated until all of the drawing is done and 2: I suspect that the more processor time that is spent rendering new screens is less is available to get the drawing done as quickly as possible. So, is there any way that I can get vb to refresh the screen only when I tell it to with the refresh command?
Thanks,
Rob
-
Sep 23rd, 2000, 07:19 AM
#2
Fanatic Member
Set the autoredraw property to true. That will fix it.
-
Sep 23rd, 2000, 10:23 AM
#3
Thread Starter
New Member
I could be wrong, but I thought that setting the autoredraw property to true would cause the form to automatically redraw what was in the screen. Like if you drew on a form and then minimized it, when you maximize it again, vb will automatically redraw what was on it as opposed to erasing it all. What I am looking for is a way to tell vb that under no circumstances is it to refresh the screen without me specifically telling it to.
-
Sep 25th, 2000, 09:13 AM
#4
PowerPoster
Do all your drawing on a back buffer (either a memory DC, or an invisible picture box), then bitblt it to the screen.
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Sep 25th, 2000, 06:23 PM
#5
Thread Starter
New Member
I'm a newbie. Can you please elaborate on that?
-
Sep 26th, 2000, 12:47 AM
#6
Fanatic Member
Create a invisible picture box. Do all the drawing on the invisible one. Set the autoredraw property to true and refresh it when you finish your drawings. Now, add a visible picture box. This one is th user display. Set the autoredraw property of this picture box also to true. When you finished drawing on the invisible one, you bitblt it to the visible one. After bitblting, you refresh it.
For info on using bitblt: watch this site:http://209.207.250.135/ref/b/bitblt.html
-
Sep 26th, 2000, 06:48 AM
#7
transcendental analytic
Autoredraw is the correct solution if you use drawing methods like bitblt, setpixelv or lineto and other apis, you use refresh method to refresh the drawings.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Sep 26th, 2000, 11:30 PM
#8
Code:
Bitblt(Destination [Form, picbox] Handle, x in Destination, y in Destination, width in Destination, source Handle, x in source, y in source, flags)
or:
Code:
LIB gdi32
Function BitBlt (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
PARAMETERS:
hDestDC
The Destination bitmap that BitBlt performs its' operations on.
x
The x position inside the destination bitmap that you want BitBlt to manipulate.
y
The y position inside the destination bitmap that you want BitBlt to manipulate.
nWidth
The width of the area you want manipulated by BitBlt.
nHeight
The height of the area you want manipulated by BitBlt.
hSrcDC
The value of the Source bitmap Device-Context location. This tells BitBlt where in memory the bitmap is located that is providing the source for your transfer to the destination bitmap.
xSrc
Tells BitBlt where inside the source bitmap to start getting its' bitmap data at the x position.
ySrc
Tells BitBlt where inside the source to get its' bitmap data at the y position.
dwRop
Tells BitBlt what raster operations to perform while manipulating the pixels between the source and the destination. Raster operations is the term used to decribe how BitBlt manipulates the data. It can do a number of differnt things, from just copying between the source and the destination, to erasing either the source or destination bitmaps! We will get into that in a bit. On to Part 2!
Operations:
Public Const SRCCOPY = &HCC0020
Copies the source bitmap and transfers it to the destination bitmap
Public Const SRCAND = &H8800C6
Copies the source bitmap and logically "ands" it with the destination bitmap, combining the color of the pixels
Public Const SRCPAINT = &HEE0086
Either leaves the source bitmap pixels alone if they are 0, or copies them if they are greater than 0
Public Const SRCINVERT = &H660046
Takes your source bitmap, copying them to the destination bitmap, while inverting the colors
Public Const SRCERASE = &H440328
Erases the source bitmap.
Public Const NOTSRCCOPY = &H330008
Copy only pixels to the destination from the source that are not the same color as the destination bitmap
Public Const NOTSRCERASE = &H1100A6
Erase only pixels in the destination that are not the same color as the source bitmap
Public Const MERGECOPY = &HC000CA
Combines all the pixels from both the source and the destination bitmaps without adding the color values together
Public Const MERGEPAINT = &HBB0226
Combines all the pixels from both the source and the destination bitmaps and combines the color values together
Public Const DSTINVERT = &H550009
Inverts all the pixels in the destination bitmap
Public Const BLACKNESS = &H0
Fills the destination with the color 0 (black)
Public Const WHITENESS = &HFFFFFF
Fills the destination with all color bits set to 1 (white)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|