SaveToFile.zip

TImage.Bitmap fade out

377

Put a TImage (Image1) on a Delphi form and load a bitmap of 24 bits or 32 bits in it; put a TButton (Button1) and put this code in its OnClick event:

TColor to HTML color

419

Put a TColorDialog (ColorDialog1),a TLabel (Label1) and a TButton (Button1) in your form,and assign the Button1.OnClick procedure as follows:

Show *any* graphics as Glyph on a SpeedButton

550

TBitBtn and TSpeedButton accept only BMP pictures, if you have some other picture format, like ICO or JPG, (in an Image component) you want to show as a Glyph, you'll need to "transform" it to Bitmap, here's how:

Rotating Text

453

Here is an example of text output that is rotated 45 degrees:

Is Point in Polygon?

370

This solution checks how many times you cross a line to pass from point X,Y to the edge of the polygon….

Implementing a lasso drawing technique

392

Here's one approach to drawing a lasso rectangle using Delphi:1.In the OnMouseDown event for the form that you are 'lasso-ing' controls on:2.In the OnMouseMove event for the form….3.In the OnMouseUp event for the form….4.The DrawMarquee procedure….

Grayscaling a bitmap ?

537

This example uses an averaging mechanism to obtain grayscale intensity on a pixel-by-pixel basis.Specifically,it averages the Red,Green and Blue component values of a color and assigns that value back to each RGB component. Usage:Here's the source code can...

How to convert HIcon to TIcon ?

452

Many Windows API functions return a HIcon value (handle to Icon).Here's how to "convert" a HIcon to TIcon (object).For example,when using ExtractIcon to get icon from file,the resulting value is of the HICON type.The answer is: Create a TIcon object and as...

Convert TColor to Hex & Hex to TColor

598

Here are two simple functions to convert color values from TColor to Hex (HTML) and vice versa:function TColorToHex(Color : TColor) : string;begin   Result :=     IntToHex(GetRValue(Color), 2) +     IntToHex(GetGValu...

Implementing C#'s foreach loop in Delphi 8

463

In C# the foreach statement repeats a group of embedded statements for each element in an array or an object collection. Delphi 8 does not have an eqivalent of the foreach statement. Let's see how to code a foreach statement in Delphi...First, here's a sim...

How to Convert Pixels to Millimeters

626

If you need to convert pixel value to millimeters (inches,centimeters,etc.) use the code provided here.The code uses the API function GetDeviceCaps to get the metrics you need.