Results 1 to 8 of 8

Thread: NO! Stop refreshing, you silly screen, you!

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    3

    Question

    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

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Set the autoredraw property to true. That will fix it.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    3
    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.

  4. #4
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    3
    I'm a newbie. Can you please elaborate on that?

  6. #6
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    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

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  8. #8
    Guest
    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
  •  



Click Here to Expand Forum to Full Width