Home   .......

Hide to Desktop Tutorial

More Technical Background

Products  
eXamples  
Files  
e-Mail Us  
 

 

Oh, no - there is more. But it is now VB-related and you should already know it. It is not that much, just take a look:

As you know, VB uses twips as a metric unit. But API uses pixels. To convert from twips to pixels, you make use of Screen global object's properties TwipsPerPixelsX and TwipsPerPixelsY. It is illustrated in the example's code.

DoEvents is used to let the system (Windows) process anything that's happened at a given time during some continuous VB code. In this sample, it is used to get sure that some operations are done before the following them code is executed.

Picture object's .hDC gives you the DC of the picture's window. The .Picture property contains the picture you have set to this object. If you haven't specified such, it is the background color. If you set the picture's AutoRedraw property to True, the contents of the picture will be automatically returned to its original state (either a picture or the background color). The Image property is actually the bitmap object of the DC. So the image contains what is currently displayed on the picture and the .Picture the default picture. If you have AutoRedraw set to True, whatever you draw on the picture will be reset to the default view. But if you have AutoRedraw set to False, when you draw something on the picture it will remain there until the picture is refreshed.

For example, if you set AutoRedraw to false and draw a circle on the picture, the Image property will contain the circle and the .Picture property not. If you then move the window outside the screen and then return it back, it will cause the window to be refreshed and then the circle will be lost. Neither the Image nor the Picture property will contain it.

Now, if you set AutoRedraw to False, draw a circle and then just cast a spell - Picture.Picture = Picture.Image, the picture will now contain the circle. And if you refresh the window, the picture will be reset to its .Picture property and the circle will remain permanent.

This is a very important concept. If you do not understand it yet, do read about it again, and read VB help if you still cannot get it.

And lastly, Randomize is used to get sure the random number generated by Rnd will be random. Read VB help if you need more info.

 
Copyright (c) 1999, Billy&George Software and Peter Dimitrov
Revised May 1999