|
(Screen Saver) diffuseGravity
|
Total Hit (2953) |
This screen saver simulates 4 particles with gravity, and draws color changing lines between them. Gravity, refresh, and number of color bars are fully configurable, and you end up with some VERY neat pictures. I used the screen saver template at vbhelper.com as a starting point.
....Read More |
Rating
|
|
|
Animated form icons
|
Total Hit (4031) |
You can add a professional touch to your apps by showing an animated icon when the main form is minimized. To achieve this effect, prepare an array of Image controls, each one containing the icons that make up the animation, then add a Timer control, with the Enabled property set to True and the Int
....Read More |
Rating
|
|
|
Build a simple browser for icons
|
Total Hit (3039) |
Winodws uses a special browser to show all icons contained in a file and offers the end user the possibility to choose an icon from it. You can add this functionallity to your applications through an undocumented API function, SHChangeIconDialog. Its Declare is:
«Code LangId=1»
Declare Function
....Read More |
Rating
|
|
|
Convert a color value to a gray scale
|
Total Hit (3327) |
When you have a 32-bit color value, you can convert it to a grey-scale - that is, you can determine how it would appear on a monochromatic display (more or less) using the following function:
«Code LangId=1»
Function GetGreyScale(ByVal lColor As Long)
lColor = 0.33 * (lColor Mod 256) + 0.59
....Read More |
Rating
|
|
|
Copy the contents of the screen or the active window
|
Total Hit (5523) |
The standard way to copy the contents of the screen or a window to a picture box requires you to use a lot of API functions, such as BitBlt. A simpler approach is possible, though: you just have to simulate the typing of the Print Screen key (or Alt+Print Screen if you want to copy the contents of t
....Read More |
Rating
|
|
|
Display an animated GIF using the WebBrowser control
|
Total Hit (4371) |
The standard PictureBox control doesn't support the Animated GIF graphic format. However, you can display these images by using a WebBrowser control:
«Code LangId=1»
WebBrowser1.Navigate "c:\Images\Animated.Gif"
«/Code»
The only problem of this technique is that the WebBrowser control also di
....Read More |
Rating
|
|
|
Extract Red,Green,Blue components of a color
|
Total Hit (3014) |
If you have a 32-bit color value in RGB format, you can extract its Red, Green and Blue components using the following routines:
«Code LangId=1»
Function GetRed(ByVal lColor As Long) As Long
GetRed = lColor Mod 256
End Function
Function GetGreen(ByVal lColor As Long) As Long
GetGre
....Read More |
Rating
|
|
|
Extract RGB components from a Long value
|
Total Hit (3093) |
You can extract RGB values out of a 32-bit color value by using the integer division and the MOD operators, but there is a much more effective way, based on the LSet. You can convert from a long to rgb bytes and vice versa with the following code:
«Code LangId=1»
Private Type RGBWrapper
Red
....Read More |
Rating
|
|
|
Getting a pixel color
|
Total Hit (3958) |
The Point method returns the color value of a given pixel, but is rather slow because it has to convert its argument from twips (or whatever ScaleMode is currently active) to pixels, and also because its argument are treated as Single quantities, and must therefore converted. When you have to retrie
....Read More |
Rating
|
|
|
Retrieving Bitmap properties
|
Total Hit (4186) |
The Picture box control does not directly expose any property that returns information on the bitmap currently loaded. You can retrieve this information by calling the GetObject API function, passing it the handle of the bitmap. This value is the Handle property of the IPictureDisp object (which is
....Read More |
Rating
|
|
|
Setting a pixel color
|
Total Hit (3604) |
The PSet method is much slower than it should actually be, and in most cases you will find it convenient to substitute it with direct calls to the SetPixel API functions. This function is about twelve times faster than the VB's method, at least when you can set the form's ScaleMode to Pixels, for mo
....Read More |
Rating
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|