Delphi Graphics: VCL & RTL

bookmark.gif (183 bytes) Delphi Visual Component Library (VCL) Graphics Components

(bookmark.gif (183 bytes) Bookmark)


AmazonTechnical.gif (2495 bytes)  in   look for 

Delphi Graphics
Delphi
Graphics


VCL Bug List:  VCL Graphics

Component Property/Event Description/Comments/Example
TAnimate   Using an AVI file with TAnimate (FAQ 2366D)
TBevel   TransparentButton, pp. 290-292, How to Program Delphi 3
Display clear button over a user-defined bitmap using TBevel and transparent TLabel.   Set Bevel.Enabled := FALSE to trap Image MouseMove events over the Bevel.
bookmark.gif (183 bytes)TBitBtn general info Bitmaps and captions on TBitBtn (FAQ 1758D)
Click a speed button in code (FAQ 2044D)
How can I have a TBitBtn component that has word-wrapped caption? (FAQ 1754D)
Keeping a glyph's transparent area transparent (FAQ 1385D)

efg's example of TControl to TBitmap including a TBitBtn

Caption Use the Line Fee (#10 or #$0A) or the Carriage Return (#13 or #$0D) in the caption string at runtime for multi-line button text.  Example:

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  BitBtn1.Caption := 'One'#10'Two'#13'Three'#$0A'Four';
end;

MultiLineBitBtn.jpg (2630 bytes)

Glyph The color of the lower left pixel is the transparent color for the glyph

In D2-D3, look for glyphs in
\Program Files\Borland\Delphi n\Images\Buttons

In D4-D5, look in
\Program Files\Common Files\Borland Shared\Images\Buttons

Richard Fellner's Collection of 9452 glyphs
http://inner-smile.com/dl_div.htm#glyph
bookmark.gif (183 bytes) TBitmap

TBitmap, BMP, DIB page

TBlobField   Save and load metafiles in a BLOB field without using DBImage (FAQ 878D)
TBlobStream   Save and load metafiles in a BLOB field without using DBImage (FAQ 878D)
TBrush Bitmap Example of how to define Brush.Bitmap programmatically

efg's Brush Bitmaps Lab Report

Color Creating temporary canvas (FAQ 1277D)
Handle TBrush.Handle is a Windows hBrush
Style TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross);

The graphic above was created using Printer Demo #2.  See comments there about the bsClear enigma.

Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr

Use bsClear when writing text with a transparent background.  See Eddie Shipman's UseNet Post with sample of how to create Outline/Shadow Text using bsClear

TButton   Bob Villiers' UseNet Post about converting a button to a bitmap.

Life and Death of TButton:  An Under-the-Hood Comparison of the VCL and CLX, Delphi Informant
www.delphiinformant.com/features/2001/01/di200101rk_f/di200101rk_f.asp 

Using Ampersands inside Delphi (FAQ 807D)

The Life and Death of TButton

Related:
How can I simulate a button click in code? (FAQ 2313C)
Want a TButton with a Canvas? by Dave Parsons

TransparentButton, pp. 290-292, How to Program Delphi 3
Display clear button over a user-defined bitmap using TBevel and transparent TLabel.   See a similar example.  A better approach is shown in Chapter 13 of  Mastering Delphi 5 (pp. 608-609), Marco Cant¨ shows how to create an "active" TMdActiveButton component that captures CM_MouseEnter and CM_MouseExit events.

Also in Chapter 13 of  Mastering Delphi 5 (pp. 623-624), Marco Cant¨ shows how to create a TMdSoundButton component that plays one sound when the button is pressend and another when it is released.

As far as I know, there is no way to have multiple lines of text on a TButton, but this can be done with a TBitBtn.

bookmark.gif (183 bytes) TCanvas general info A TCanvas is just a Windows device context.   Call GDI methods using the Handle property of the canvas.  A device context has no persistence.  (Also, see TImage).

Msg 'Canvas does not allow drawing' www.delphifaq.com/fq/q4053.shtml 

Delphi Pool TCanvas/TControlCanvas Tips
www.lmc-mediaagentur.de/dpool/graph05.htm 

Finding the color depth of a canvas (TI 1507D)

Arc See DrawArcs example

Because Windows 95/98 uses a 16-bit coordinate system, the sum of the coordinates of the bounding rectangle specified by the Arc cannot exceed 32K.

Brush Transparent property to work for a CoolBar background bitmap (FAQ 1390D)

Windows limits the pattern of bush bitmaps to 8-by-8 pixels, and they must be device-dependent bitmaps.  Windows will reject pattern bitmaps larger than 8-by-8.  NT will accept larger bitmaps but will only use the top-left 8-by-8 portion. 

Setting the Brush Bitmap property
p. 7-8, Delphi 5 Developer's Guide

BrushCopy Transparent property to work for a CoolBar background bitmap (FAQ 1390D)
Keeping a glyph's transparent area transparent (FAQ 1385D)
Adding graphics in your Listboxes and Comboboxes (TI 725D)

Steve Schafer's UseNet Example
Thomas' UseNet Example

Chord See Printer Demo #2

Because Windows 95/98 uses a 16-bit coordinate system, the sum of the coordinates of the bounding rectangle specified by the Chord cannot exceed 32K.

ClipRect Cliprect is readonly and returns the clipping rectangle in effect when the last WM_PAINT message was received

Example: Canvas.FillRect(Canvas.ClipRect);

Clearing the contents of a Canvas (FAQ 2087D)

Roy Green's UseNet Post about ClipRect

CopyMode Delphi 5 Developer's Guide by Teixeira and Pacheco in Online "CD" Chapters, pp. 78-83
CopyRect Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr
Example by Dave Parsons (Do not use StretchDraw as Dave suggests for printing.  See Printer Demo #1.

See efg's Newsgroup Post about using SetStretchBltMode before CopyRect (but not before StretchDraw).  See other info about SetStretchBltMode.

Draw Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr
Stretchdraw on an icon (FAQ 1818D)
How can I create a bitmap from an icon? (FAQ 2752D)
How can I create an icon from a bitmap? (FAQ 2748D)
Loading Bitmaps and Cursors from RES Files (TI1081D)
Converting a BMP to a JPEG and Vice Versa (TI 4582D)
efg's Printer Demo #1 Lab Report
DrawFocusRect Selection rectangle (FAQ 1073D)
Ellipse procedure Ellipse(X1, Y1, X2, Y2: Integer);

Note: In Windows 95

  • the sums X1 + X2 and Y1 + Y2 cannot exceed 32768,
  • the sum X1 + X2 + Y1 + Y2 cannot exceed 32768.

Because Windows 95/98 uses a 16-bit coordinate system, the sum of the coordinates of the bounding rectangle specified by the Ellipse cannot exceed 32K.

New overload available in D5:
procedure Ellipse(const Rect: TRect); overload;

Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr
Color problems in 256 color mode (FAQ 2780D)
PtInRegion pixel function (FAQ 2857D)
How do I plot a line? (FAQ 2934D)
How can I create an icon from an (sic) bitmap? (FAQ 2748D)
efg's "Daisy" Lab Report

Q:  How can I draw an ellipse without filling the inside?
A:  Set the brush to clear:
Canvas.Brush.Style := bsClear;

Also see Rotated Ellipse example

FillRect Examples:
Clear Canvas:
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Canvas.ClipRect);

Image.Canvas.FillRect( 
  Rect(0,0, Image.Width, Image.Height) );


Clearing the contents of a Canvas (FAQ 2087D)
PtInRegion pixel function (FAQ 2857D)
How can I create a dynamic array of TPoints to draw a polygon? (FAQ 919D)
How can I create an icon from a bitmap? (FAQ 2748D)
Creating temporary canvas (FAQ 1277D)
FloodFill procedure FloodFill(X,Y:  Integer; Color:   TColor; FillStyle:  TFillStyle);

If FillStyle is fsBorder, the area fills until a border of the specified Color is encountered.  If FillStyle is fsSurface, the area fills as long as the color specified by Color is encountered.  fsSurface fills are useful to fill an area with a multicolored border.

UseNet Post with responses to "How can I use FloodFill on Printer.Canvas?"
Steve Schafer:  "Not all GDI devices support FloodFill. Printers are especially unlikely to support it."  Joe Hecht:  "the reason is there is often no frame buffer used for a printer. FloodFilling against pixels already printed is kinda difficult"

Handle Display Device Context Defaults:  list of attributes and values
(The Canvas.Handle is a device context).
http://msdn.microsoft.com/library/psdk/gdi/pantdraw_3xtf.htm 
Lock/Unlock (D3) Use around Canvas calls to make Canvas thread safe.
Use Canvas.Lock or Canvas.TryLock if you are trying to draw on a canvas while your last draw-operation has not yet finished.

Peter Below's UseNet Post about using Canvas.Lock/Canvas.Unlock in a thread.

MoveTo/LineTo Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr
Why Delphi drawing functions draw one pixel short (FAQ 2470D)
Creating temporary canvas (FAQ 1277D)

Joe Hecht's UseNet Post LineTo too slow on fast machines and tips to improve performance

Pixels Color of hex $FFFFFFFF: Raster Operations (FAQ 2622D)

If you create a TBitmap and do not define its height and width, the Pixels value will be -1 ($FFFFFFFF) and may cause range-check errors.

Accessing many pixels using the Pixels property will be very slow.  Use Scanline instead.
Manipulating Pixels With Delphi's ScanLine Property 

PolyBezier Boris Novgorodov's UseNet Post with PolyBezier example
PolyLine "The PolyXXX family of functions have a limit on the number of points they can draw. This limit depends on the width of the line (that is, the width of the pen selected into the DC), as shown in the following table."
Line Width Max Number of Points
line width = 1 16K
line width > 1, 
device supports wideline
16K
line width > 1,
device does not support wideline
approx. 1360
(a few less than
16K / 12)

Source:  http://msdn.microsoft.com/library/psdk/win95/chilimit_8wit.htm 

How to Draw a Rubber-Banding Line by Robert Vivrette www.undu.com/DN960901/00000007.htm

A Simple Drawing Program
www.undu.com/DN970901/00000020.htm

Rectangle procedure Rectangle(X1, Y1, X2, Y2: Integer);

New overload available in D5:
procedure Rectangle(const Rect: TRect); overload;

Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr
Drawing in scale without using Windows Mapping Modes? (FAQ 2736D)
How can I draw using LoEnglish Mapping Modes? (FAQ 2771D)

RoundRect Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr

Because Windows 95/98 uses a 16-bit coordinate system, the sum of the coordinates of the bounding rectangle specified by the RoundRect cannot exceed 32K.

bookmark.gif (183 bytes) StretchDraw Stretchdraw on an icon (FAQ 1818D)
Extracting Icons (FAQ 1778D)
Creating temporary canvas (FAQ 1277D)

efg's UseNet Post with example of creating TBitmap that is half the width and half the height (one quarter the area) as an original TBitmap.

According to a UseNet Post by Joe Hecht, StretchDraw can only be used to enlarge a bitmap by a factor of about 8.

NEVER use StretchDraw for printing a bitmap.  See "How can I print a bitmap?" or efg's Printer Demo #1 Lab Report

procedure TForm1.Button1Click(Sender: TObject);
  VAR
    BitmapOriginal:  TBitmap;
    BItmapNew     :  TBitmap;
begin
  BitmapOriginal := TBitmap.Create;
  TRY
    // Load 768-by-512 bitmap
    BitmapOriginal.LoadFromFile('Balloons.BMP');

    BitmapNew := TBitmap.Create;
    TRY
      BitmapNew.Width  := 80;
      BitmapNew.Height := 60;
      BitmapNew.PixelFormat := pf24bit;

      // Shrink original bitmap to new size
      BitmapNew.Canvas.StretchDraw(
           BitmapNew.Canvas.ClipRect,
           BitmapOriginal);

      // Display new, smaller bitmap
      Image1.Picture.Graphic := BitmapNew
    FINALLY
      BitmapNew.Free
    END
  FINALLY
    BitmapOriginal.Free
  END
end;

TextFlags (D4) Specify flags that are used by the API routine ExtTextOut, which is called from TCanvas.TextOut and TCanvas.TextRect
TextOut Avoiding flicker on drawcell (FAQ 1770D)
Drawing transparent text onto a TBitmap (FAQ 2079D)
Changing font color on standard win controls (FAQ 2716D)
Making text background transparent (FAQ 627D)

For a transparent background with text:
   Canvas.Brush.Style := bsClear;
Eddie Shipman's UseNet Post with sample of how to create Outline/Shadow Text using bsClear

By default, the upper left corner of the text box is the origin. See the SetTextAlign Windows API call for details.

Dave Martel's UseNet Post about XOR text to a TCanvas (DrawTextXOR function)

TClipboard   Bitmaps and InterBase BLOB Fields (TI 797D)
bookmark.gif (183 bytes) TColor   D3:  TYPE TColor = $80000000..$7FFFFFFFF
(that is, -2,147,483,648..2,147,483,647)

D4/D5:  TYPE TColor = -$7FFFFFFF-1..$7FFFFFFF

The internal format of TColor can have five formats:
1.  $00bbggrr -- Create using the RGB function
2.  $010000nn -- Create using the PaletteIndex function
3.  $02bbggrr -- Create using the PaletteRGB function
4.  $800000nn -- Defined in Graphics.PAS using Windows constants COLOR_SCOLLBAR, etc.  These negative values must be passed to the ColorToRGB function to have R, G and B components defined.
5. $FFFFFFFF -- If you create a TBitmap and do not define its height and width, the Pixels value will be -1 ($FFFFFFFF) and may cause range-check errors.  Also see Raster Operations (FAQ 2622D).

In D3 a DWORD is an Integer, but in D4 a DWORD is a LongWord.  A TColor value of -1 now creates a Range Check Error in D4, which is returned by Canvas.Pixels when the property is undefined like when a TBitmap is created without any assignment to Width or Height.

The "negative" colors include:
clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder, clAppWorkSpace, clHighlight,clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk  

To extract just one of the R, G, B components from a TColor value, use the corresponding GetRValue, GetGValue, or GetBValue function (see below ).

The PaletteRGB function sets the high byte of the colour to $02. To get the nearest color use the GetNearestPaletteIndex function.

How do I convert a color to a shade of gray? (FAQ 2728D)
Color of hex $FFFFFFFF: Raster Operations (FAQ 2622D)

efg's UseNet Post about typecasting a shifted TColor to a TRGBQuad.

See Color Section of Delphi Graphics Algorithms page

For general color information, see the (non-Delphi) Color Reference Library

TColorDialog   Borland examples:
..\Delphi n\Demos\Doc\GraphEx.dpr
..\Delphi4\Demos\CustomDraw.DPR
..\Delphi n\HELP\Examples\Menu\MenuDemo.PAS
TComboBox   Adding graphics in your Listboxes and Comboboxes (TI 725D)
How to check a ComboBox without OnClick occurring (TI 1237D)

efg's example of Geometric Pen in user-defined  TComboBoxes showing various line widths and styles

TControl GetPalette The GetPalette for a TControl returns a null handle, indicating the control does not have a palette. Override GetPalette to implement derived objects that use a palette.

True Transparent Images With Masking by Robert Vivrette www.undu.com/DN970101/00000022.htm

Perform efg's example of TControl to TBitmap

Bill Zissimopoulos' UseNet Post about how copy the area behind a component

TCoolBar general The CoolBar Component
(from Chapter 13, Teach Yourself Borland Delphi 4 in 21 Days)
www.cesis.lv/learn/delphi/ch13.htm#Heading3 

Are You Cool?
http://delphi.about.com/compute/delphi/library/weekly/aa062000a.htm 

StatusBars and ToolBars
www.kovcomp.com/D3UID/sampchap/chap4.html 

bookmark.gif (183 bytes) TCursor  

Changing Cursor

Method 1   Method 2
VAR
  OldCursor:  TCursor
BEGIN
  OldCursor := Screen.Cursor;
  Screen.Cursor := crHourglass;
  TRY
    // lengthy operation here
  FINALLY
    Screen.Cursor := OldCursor
  END
END;
or   Screen.Cursor := crHourglass
  TRY
    // lengthy operation here
  FINALLY
    Screen.Cursor := crDefault
  END

How to create a custom cursor
How to set/reset the Screen.Cursor

How to Create BMP files for Standard Cursors
(also includes list of Standard Cursor definitions)
see  Cursors on efg's Delphi Graphics Algorithm page

CopyCursor (FAQ 1067D)
How to use a custom cursor (TI  956D)
Linking an animated cursor to a resource file (FAQ 2841D)
Loading a Custom Cursor from a RES file (TI 1075D)
Loading Bitmaps and Cursors from RES Files (TI 1081D)
Using an animated cursor (FAQ 580D)

Eddie Shipman's UseNet Post about making a rainbow background on a form (see procedures CursorOff and CursorOn)

Chris Hill's UseNet Post:  How to Create a Cursor from a Bitmap

Thomas' UseNet Post about how to extract the cursor image from a cursor file for drawing on a bitmap

See Screen.Cursor and Screen.Cursors below.

Creating and using a special cursor, pp. 525-531, Delphi Programming Problem Solver, Neil Rubenking

Also see file type "CUR" on efg's Graphics File Formats and Conversions page or "Cursors" on efg's Graphics Algorithms page.

TDBGrid   DBGrid Images, etc.:  Taskbar Tips and Environment Variables
www.delphizine.com/features/2001/01/di200101bs_f/di200101bs_f.asp 
TDBImage   Steve Koterski's UseNet Post with TDBImage explanation and how to handle JPEG.

DBTransparentImage is a descendant of TDBImage which, though not itself transparent - it has a background colour - can draw blobs  transparently on it.http://delphi.icm.edu.pl/ftp/d20free/dbtimage.zip by Deborah Pate

TDrawGrid   Avoiding flicker on drawcell (FAQ 1770D)
TEdit   Drawing on a TEdit Component by Angus Johnson
www.undu.com/Articles/980318a.htm

How to Right Justify Text in a TEdit
www.undu.com/Articles/000207c.html

Dr. Bob's Tip:  Right-Aligned T42Edit

Right justification for numbers (Usenet post)

Only numerical input in a TEdit
www.festra.com/eng/sources.htm#onlynum 

Changing the Caret of a TEdit
www.delphizine.com/features/2001/02/di200102bs_f/di200102bs_f.asp 

Prevent the TEdit Component from beeping when invalid (FAQ 759D)
Validating input in TEdit components (TI 1171D)

TFileStream   Save and load metafiles in a BLOB field without using DBImage (FAQ 878D)
Also see File Stream I/O page
bookmark.gif (183 bytes) TFont general info Use bsClear Brush when writing text with a transparent background.

Delphi 3 or 4: ..\Demos\Ownerlst\FontDraw.DPR

Assuring Proper Font Scaling When Printing (TI 1547D)
Control Font Styles (TI 803D)
Saving a TFont object (FAQ 2692D)
Saving TFont information (FAQ 1660D)

Antialiased Fonts
Chris Hill's UseNet Post about Antialiased Fonts
Yorai Aminov's UseNet Post about Antialiased Fonts

Large Fonts  Somewhere in the Display Settings (which can vary by display adapter) there is a selection: 
- Small Fonts (96 DPI)
- Large Fonts (120 DPI)

You can set the form's scaled property to False, but I still have seen undesirable effects. Setting Form.Scaled := FALSE will keep the visual controls the same size and in the same location, but according to the "rules" you always need to allow extra space with TLabels for either size font. 

The whole Display Settings Font Size seems to be a bad idea, or badly implemented.  As far as I know, there is no good solution to "small" versus "large" fonts in Windows. Basically, all screen text locations need to be designed to hold the "small" font or a "large" font that is 125% the size of the "small" font. Sometimes space is so tight to accomplish some goal, that it's just not possible for large fonts to work correctly.

Neil Rubenking's "FontViewer" utility in PC Magazine -- speed up Windows by eliminating unneeded fonts.

Peter Below's UseNet Post with suggested approach
Form display with different screen resolutions (TI 944D)

Dmitri Papichev's UseNet Post with suggestions:
- Turn off Scaled property of the forms
- Use only TrueType fonts (.TTF) but not those = with .FON extension

David Barnard's UseNet Post and design mode considerations
Douglas' UseNet Post about Large Fonts
Steve Schafer's (TeamB) UseNet Post about Large Fonts
Finn Tolderlund's UseNet Post, Windows font size problem 
Checking for large fonts, www.preview.org/q/q1020.shtml

Rotated Fonts
Creating a rotated font (FAQ 615D)
How can I display a rotated font?
How can I print a rotated font?

TrueType Fonts
Steve Schafer's (Team B) UseNet Post with IsTrueType function
Checking if True Type fonts are available (FAQ 2466D)
Adding TrueType fonts to windows in code (FAQ 2537D)

Screen.Fonts and Printer.Fonts are TStrings lists of fonts that can
be used on the display and the printer.  For an example of using
Screen.Fonts, see the Wrap Text Inside Circle Lab Report.

How to Show Fonts in a ComboBox
www.swissdelphicenter.ch/en/showcode.php?id=287 

non-Delphi: 
Microsoft's "Fonts and products"
www.microsoft.com/typography/fonts/default.asp 

Assign Error 'There are no fonts installed' (FAQ 2958D)
Color Changing font color on standard win controls (FAQ 2716D)

Peter Below's UseNet Post about Font Color Limitations

Handle TFont.Handle is a Windows hFont
bookmark.gif (183 bytes) TForm general info How to do textout in the caption region of a form?
See UseNet Postings by Renaldas and Charles Hacker

Making Forms Work : Part I: Single Document Interface (SDI)
www.delphi-jedi.org/Jedi:VOYFORMS1

Making Forms Work : Part II:  Communicating Between Forms
www.delphi-jedi.org/Jedi:VOYFORMS2

Making Forms Work:  Part III:  Windows Messages
www.delphi-jedi.org/Jedi:VOYFORMS3

Making Forms Work:  Part IV:  Interaction and Feedback
www.delphi-jedi.org/Jedi:VOYFORMS4

Transparent Form
www.vissers.net/delphi/TransparentForm.html 
www.depaashaas.com/delphi/more/transparent.html  

Gruhn's Transparent Delphi App
www.hwb.com/gruhn/programming/tutorial/clear.html 

Shannon Broskie's UseNet Post with DrawTitleBarImage function
Peter Below's UseNet Post with CopyFormRectToBitmap procedure

How can I create a transparent form?
www.delphi3000.com/articles/article_327.asp 

Changing the main form of an app. at runtime (FAQ 1695D)
Drag a Form without clicking the caption bar (TI 605D)
Draw On Frame (FAQ 1079D)
How to scroll your form with pgUp and pgDn (TI 593D)
How to set a max and min form size (TI 968D)  [use Form.Constraints in D4]
Making a form selectable without the main form (TI 536D)
Minimizing Application When a Form Minimizes (TI 1602D)
Preventing a Form from Resizing (TI 1141D)
Setting a form's maxwidth in code (FAQ 2559D)
Subclass the windows procedure for a TForm (FAQ 1025D)
Using OnHint Events Among Mulitiple Forms (TI 731D)

Resizing Forms

Elena's UseNet Post with example of iterating through all components on a form to resize them

ResizerPanel.  Want your Forms to work in any graphic resolution?  This component automatically adjusts all child controls size proportionally to the panel current size. Including font size, column widths, etc...  With this you can easily deploy graphic resolution independent applications.  ftp://carlos.123webhosting.net/pub/resizer.zip

Miscellaneous

A Form's canvas does not "remember" what you painted on it when the form repaints itself.  Therefore, when painting on a Form's canvas, always do it in the OnPaint method.

Full Screen:
Form1.BorderStyle := bsNone; 
Form1.Width  := Screen.Width; 
Form1.Height := Screen.Height;

Chapter 1, Delphi Programming Problem Solver by Neil Rubenking
- Eliminating a form's caption but leaving the border (p. 9)
- Getting the "tiny title bar" effect (p. 12)
- Taking over drawing a form's caption (p. 23)
- Putting a button on a form's title bar (p.27)
- Taking over drawing a form's frame (p. 30)

MDI Forms:
Richard's UseNet Post with information about difference between MDI parent and MDI child forms

Brush Used automatically by Windows to paint the form's background
Canvas TNCCanvas - write on a form's non-client area
http://delphifaq.com/fq/q2005.shtml 
ClipRect Using InvalidateRect to repaint the entire form (FAQ 1235D)
Constraints (D4) Set Min/Max Height/Width of a form.  

Before D4, capture use  wm_GetMinMaxInfo message
- example in efg's MazeMaker Lab Report
- Dets' UseNet Post about form minimum size

ControlStyle To prevent the form from repainting its background every time it does a
paint, which can cause flicker even when using the double buffering trick, put the following in the FormCreate:
Form1.ControlStyle := Form1.ControlStyle + [csOpaque];
DoubleBuffered (D4) When DoubleBuffered is False, the windowed control paints itself directly to the window. When DoubleBuffered is True, the windowed control paints itself to an in-memory bitmap which is then used to paint the window. Double-buffering reduces the amount of flicker when the control repaints, but is more memory intensive.
GetPalette

See TForm1.GetPalette in pp. 329-333, Delphi Programming Problem Solver, Neil Rubenking

Eddie Shipman's UseNet Post about making a rainbow background on a form

Paint How to paint a form with a bitmap (TI 551D)

Background Bitmaps on Forms
by Robert Vivrette, www.undu.com/DN961001/00000006.htm

How to Make a Polygonal Splash Screen
by Michael Barnes www.undu.com/DN970101/00000006.htm

Eliminate flicker when painting on a form or a TPaintbox control (for CPP Builder, but should be easily adaptable to Delphi), www.bcbdev.com/faqs/faq34.htm

See \Program Files\Borland\Delphi n\HELP\Examples\Bitmap\BMPFormU.PAS
PixelsPerInch Steve Trefethen's (Delphi R&D) comments about PixelsPerInch problem:  Set " TForm.AutoScroll = False AND develop on _ALL_ development machines in Small fonts leaving TForm.Scaled alone (it's default value is True).  If the IDE had these problems we would hear about it non-stop on the public newsgroups but it's never mentioned (WRT the IDE) which to me is proof that we have it right."
OnMouseDown, OnMouseMove, OnMouseUp Moving a control at runtime with the mouse (FAQ 2936D)
Selection rectangle (FAQ 1073D)
See \Program Files\Borland\Delphi n\Demos\Doc\Graphex\GraphWin.PAS
Scaled Finn Tolderlund's UseNet Post about Windows font size problem
TGraphic   Steve Schafer's UseNet Post with procedures SaveGraphicToStream and LoadGraphicFromStream
TIcon   Colin Wilson's UseNet Post explaining limitations of TIcon:  "if you want to manipulate icons in Delphi you've got to code it all yourself.  The VCL doesn't do what you want"

Example of comparing two TIcons

Example of converting TIcon to TBitmap

How can I create a bitmap from an icon? (FAQ 2752D)
How can I create an icon from an (sic) bitmap? (FAQ 2748D)
Extracting Icons (FAQ 1778D)
Extracting an icon from a .EXE or .DLL (FAQ 2458D)
Creating a flashing icon (FAQ 1103D)
Using an icon as the glyph in a TSpeedButton (FAQ 2122D)
Stretchdraw on an icon (FAQ 1818D)

Delphi Pool TIcon Tips
www.lmc-mediaagentur.de/dpool/graph12.htm 

Yorai Aminov's UseNet Post about How to Convert hICON to TIcon
Joe Hecht's UseNet Post with StretchDrawIcon example

ReleaseHandle Coliln Wilson UseNet Post about D4 TIcon Bug
bookmark.gif (183 bytes) TImage general info In Windows, every window must be able to repaint itself whenever Windows sends it a message to. When you use a TImage, the TImage repaints the window.  If you don't use a TImage, then you must   take the responsibility for repainting.

Delphi 3 - 7: ..\Demos\Imagview

Mauro's UseNet Post about how to paste a bitmap to a TImage

George Pistikos' UseNet Post about "TImage bug in Delphi 6?"

Paint on the contents of a TImage control.
www.bcbdev.com/faqs/faq35.htm

Sim Zacks' UseNet Post about smooth image move
Mitch Wolberg's UseNet Post about image moving

How to determine the TImage graphic type at runtime
www.lmc-mediaagentur.de/dpool/tips04/0366.htm 

How to move a TImage on a scrollbox
www.lmc-mediaagentur.de/dpool/tips05/0431.htm 

Delphi Pool TImage Tips
www.lmc-mediaagentur.de/dpool/graph07.htm 

Eliminating flicker during a TImage move operation
http://bcbcaq.freeservers.com/eliminate_flicker.html

Builder C++ Example of Moving/Dragging TImage

Array of TImages:   efg's UseNet Post

Image.Picture.Graphic.Empty: 
- efg's Newsgroup Post
-  Johnnie's Newsgroup Post

BringToFront "Working with Color Palettes," pp. 209-211, How to Program Delphi 3
Suggests using Image.BringToFront to control precedence in z-order when multiple images with palettes are displayed.
Canvas Gordon's UseNet Post about the two canvases in a TImage

According to Harold Howe's Post:  "You can only draw on the Canvas property of TImage if the Picture is empty or contains a bitmap as its graphic. You cannot draw on the Canvas of TImage if the image contains an icon or a metafile as its graphic."

Robert Rossmair's UseNet Post:  "If TImage holds a bitmap both are identical, i.e. TImage.Canvas = TImage.Picture.Bitmap.Canvas. If TImage doesn't hold a bitmap, TImage.Canvas is invalid."

Canvas vs. Picture.Bitmap.Canvas Harold Howe's Post1 to borland.public.delphi.graphics.

Robert Ro▀mair's UseNet Post:  "TImage.Canvas is a wrapper for TImage.Picture.Bitmap.Canvas; it's invalid whenever the Picture property holds some graphic type different from TBitmap"

OnMouseDown, OnMouseMove, OnMouseUp Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr

See how to set/reset the Screen.Cursor on MouseDown and MouseUp. Also shows how to restrict the cursor inside a TImage while drawing. For a complete example, see efg's Line Stretch Lab Report.

How to Draw a Rubber-Banding Line
by Robert Vivrette http://www.undu.com/DN960901/00000007.htm

How to Draw Marching Ants
by Robert Vivrette. "Marching Ants" (sometimes called a marquee rectangle) is essentially an animated rubber-banding line. http://www.undu.com/DN960901/00000008.htm

A Simple Drawing Program
www.undu.com/DN970901/00000020.htm

Rob van Putten's UsetNet Post about how to know on what color I am over a TImage.  (Also, see ShowImage Lab Report).

Parent Gordon's UseNet post about can't create and display TImage at runtime?
Picture Borland example: ..\DelphiN\Demos\Doc\GraphEx.dpr

Clear a picture in a TImage:
Image.Picture := NIL;
Image.Picture.Assign(NIL);
Stretch Save and load metafiles in a BLOB field without using DBImage (FAQ 878D)
TImageList general info Dave Collie describes the power that lurks in the TImageList component: it can do far more than immediately meets the eye.  Delphi Magazine, Issue 36, August 1998.

Dynamically drawing a transparent image (FAQ 1794D)
See ..\Delphi4\Demos\CustomDraw.DPR
Adding images to menu items, Delphi 4 Developer's Guide, p. 5-18

Jim Hollenberg's UseNet Post to avoid certain TImageList problems by turning hardware graphics acceleration off

Delphi Pool TImageList Tips
www.lmc-mediaagentur.de/dpool/graph08.htm 

The Basics of an ImageList
http://bcbcaq.freeservers.com/imagelist.html

AddMasked Dynamically drawing a transparent image (FAQ 1794D)
Image Conflicts between different versions of IE (FAQ 1846D)
Setting a transaprent (sic) background color for TImageList (FAQ 2346D)
DrawingStyle Dynamically drawing a transparent image (FAQ 1794D)
Masked Dynamically drawing a transparent image (FAQ 1794D)
TJPEGImage general info Converting a BMP to a JPEG and Vice Versa (TI 4582D)
Also see the File Formats and Conversion Page.
TLabel   efg's example of TControl to TBitmap including a TLabel

efg's example of moving TLabel at runtime with mouse events

Dr. Bob's Tip-of-the-Hat:  Shading T42Label

TList

  efg's UseNet Post about how to create TList of TBitmaps
TListBox   Adding graphics in your Listboxes and Comboboxes (TI 725D)
Enabling a horizontal scroll bar for a list box (TI 531D)
TMainMenu   Adding images to menu items, Delphi 4 Developer's Guide, p. 5-18
TMemo   Adjusting the tab locations in a TMemo component (FAQ 960D)
Determining a memo's number of lines showing (TI 1201D)

Peter Below's UseNet Post about using tab stops in a TMemo

Getting the line number in a memo Field (TI 773D)
Line := Memo1.Perform(EM_LINEFROMCHAR, -1, 0);

TTransparentMemo in UseNet Post by Benjamin

PageUp/PageDown to Scroll Up/Down in TMemo in UseNet Post by Alexandru Preda

TMemoryStream   Using JPEGs from resource files (FAQ 1882D)
Loading Bitmaps and Cursors from RES Files (TI 1081D)
Extracting a JPEG Resource from an EXE (TI 4532D)

Also see Delphi Stream I/O page 

TMetafile   How can I place a bitmap in a metafile? (FAQ 1842D)
Metafile Fonts and the VCL (FAQ 2952D)
Determining if a canvas is a Metafile Canvas?  (FAQ 2638D)
Also see the File Formats and Conversion Page
TMetafileCanvas   How can I place a bitmap in a metafile? (FAQ 1842D)
TPageControl   Peter Below's UseNet Post about texture/bitmap background on pagecontrol/tabcontrol

Owner-Drawn Tabs (Builder example)
http://bcbcaq.freeservers.com/OD_Tabs.html

bookmark.gif (183 bytes) TPaintBox   Thread Sorting Demo
Borland example: ..\Delphi n\Demos\Threads\ThrdDemo.DPR

Steve Schafer's UseNet Post:

TPaintBox.Font.Color, as well as TPaintBox.Color, is a "for your information" property. It's for the use of the code in your paint box's OnPaint event handler, and has no effect by itself. A typical OnPaint event handler might do something like this:

 begin
   MyPaintBox.Canvas.Font := MyPaintBox.Font;
   // draw on the paint box canvas here
 end;

This would transfer the various font properties to the canvas immediately before drawing any text.

Delphi Pool TPaintBox Tips
http://www.lmc-mediaagentur.de/dpool/graph10.htm 

Eliminate flicker when painting on a form or a TPaintbox control (for CPP Builder, but should be easily adaptable to Delphi), www.bcbdev.com/faqs/faq34.htm

Color Why does a PaintBox have a Color Property?
Gordon Whittam's UseNet Response

Wolfgang Pritschet's UseNet Post about painting background of PaintBox

TPanel   How to click and move components at runtime (TI 1057D)

efg's example of TControl to TBitmap including a TPanel
efg's UseNet Post explaining how to print a TPanel object

On way to draw on a Panel's canvas:

MyCanvas: TControlCanvas;
...
MyCanvas := TControlCanvas.Create;
MyCanvas.Control:=TControl(Panel1);
...
MyCanvas.MoveTo(0,0);
MyCanvas.LineTo(300,50);

TPen Handle TPen.Handle is a Windows hPen

How do I use Paths and Geometric Pens? (FAQ 2724D)

efg's example of Geometric Pen in user-defined  TComboBoxes showing various line widths and styles.  Also see example in Feathering Lab Report  and ExtCreatePen limitations in Windows 95/98.

Mode  
Style TPenStyle = (psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear, psInsideFrame);

Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr
See Printer Demo #2 Lab Report for displaying/printing with all Pen.Styles. Line styles on printed pages can vary greatly from one printer to the next.

See Tomes Graphical, p. 121, for information on how to create a PS_USERSTYLE pen style.

"Windows 95/98 does not support the dashed or dotted pen styles, such as PS_DASH or PS_DOT, in wide lines. The BS_DIBPATTERN brush style is limited to an 8- by 8-pixel brush."
http://msdn.microsoft.com/library/psdk/win95/chilimit_8wit.htm 

Width Dr. Jason Smithwick's E-mail  note with routine that draws thick lines with various pen styles

Drawing Dotted Line.  Josef Garvi's UseNet Post "How to draw dot line and pen width more than one pixel"

Gary Williams UseNet Post "Thick Dotted.Dashed Lines"

bookmark.gif (183 bytes) TPicture   A TPicture manages a list of registered graphic classes.

Michel Brazeau's UseNet Post about how to register a new graphic type to use with TPicture.

Peter Below in UseNet Post:  "Unless TPicture contains a TBitmap it has no canvas, plain and simple."

Kay Schubert's UseNet Post about how to "Prevent JPEG Error 41" with code that saves and loads ALL TPicture-contained TGraphic descendents into and from a stream, without any need to know its actual type

Delphi Pool TPicture Tips
www.lmc-mediaagentur.de/dpool/graph11.htm 

The Patrician's UseNet Post with PictureToBitmap function
Mike Shkolnik's UseNet Post about converting BLOB to TPicture

How can I place a bitmap in a metafile? (FAQ 1842D)

Use a TPicture to load any registered file type into a TBitmap:

VAR
  Bitmap:  TBitmap
  Picture : TPicture;
...
Bitmap := TBitmap.Create;
TRY
  // Use polymorphic TPicture to load any
  // registered   file type
  Picture := TPicture.Create;
  TRY
    Picture.LoadFromFile(OpenPictureDialog.Filename);

    // Try converting into bitmap
    TRY
      Bitmap.Assign(Picture.Graphic);
    EXCEPT
      Bitmap.Width := Picture.Graphic.Width;
      Bitmap.Height := Picture.Graphic.Height;
      Bitmap.PixelFormat := pf24bit;
      Bitmap.Canvas.Draw(0,0, Picture.Graphic)
    END;

  FINALLY
    Picture.Free
  END;

  // Use Bitmap here

FINALLY
  Bitmap.Free
END;

TPoint   How can I create a dynamic array of TPoints to draw a polygon? (FAQ 919D)
Creating a PolyPolygon using a point array (FAQ 2946D)
TPopUpMenu   Small bitmaps in a TPopUpMenu (FAQ 1806D)

Adding vertical text and a color bar to a popup menu
http://community.borland.com/article/0,1410,26632,00.html 

TProgressBar   See \Program Files\Borland\Delphi n\HELP\Examples\PrgrsBar/pg1.PAS

Andreas Pawlik's UseNet Post about ProgressBar in StatusBar

TRichEdit   TRichEdit FAQ 
http://home.att.net/~robertdunn/FAQs/Faqs.html 

Peter Haas' UseNet Post about RichEdit to TBitmap conversion

TScreen Cursor
Loading Bitmaps and Cursors from RES Files (TI1081D)
Loading a Custom Cursor from a RES file (TI 1075D)
Cursors Using an animated cursor (FAQ 580D)
Loading Bitmaps and Cursors from RES Files (TI1081D)
Loading a Custom Cursor from a RES file (TI 1075D)
TScrollBar   Example of how to scroll a TImage
\Program Files\Borland\Delphi n\HELP\Examples\Scrollba\ScrolDem.PAS

Width of ScrollBar:  GetSystemMetrics(SM_CXVSCROLL);

TScrollBox   Trap scrolling messages for the Scrollbars of a TScrollBox (FAQ 942D)

Canvases and Scrollboxes (Builder example)
http://bcbcaq.freeservers.com/canvas_scrollbox.html

Alex Denissov's UseNet Post with WM_HSCROLL and WM_VSCROLL examples in an EnhScrollBox derived from TScrollBox

TShape   See \Program Files\Borland\Delphi n\HELP\Examples\Menu\MenuDemo.PAS

TShape descendant that has a star shape and has OnMouseEnter/Leave handlers.  Eddie Shipman's UseNet Post

Mauro Patino's UseNet Post about how to move a TShape

TSpeedButton   Using an icon as the glyph in a TSpeedButton (FAQ 2122D

Robert Rossmair's UseNet Post with ClrSpBtn unit 
(a TSpeedButton descendant that has a Color property)

TStatusBar   StatusBars and ToolBars
www.kovcomp.com/D3UID/sampchap/chap4.html 

efg's UseNet Post about drawing a BMP on the panel of a StatusBar

Andreas Pawlik's UseNet Post about ProgressBar in StatusBar

Mauro Patino's UseNet Post about gauge in TStatusBar

TStringGrid   see TStringGrid on efg's Delphi Strings page
TTabControl   Peter Below's UseNet Post about texture/bitmap background on pagecontrol/tabcontrol

Owner-Drawn Tabs (Builder example)
http://bcbcaq.freeservers.com/OD_Tabs.html

TThread   Thread Sorting Demo
Borland example: ..\Delphi n\Demos\Threads\ThrdDemo.DPR

see additonal Threads links on efg's Delphi Miscellany page

TTreeView   see ..\Delphi4\Demos\CustomDraw.DPR

An Introduction to Custom Draw -- The Treeview Control
http://bcbcaq.freeservers.com/CustomDraw_TV.html

Peter Below's UseNet Post about how to print a treeview


bookmark.gif (183 bytes) Delphi Run-Time Library (RTL) Graphics Routines
Also see Win32 API Calls in Delphi

Name Description/Example Unit
Application Application.ProcessMessages
Difference between Create(Self) and Create(Application) (FAQ 2004D)
Simulating a mouse move in code (FAQ 2871D)
Forms
Bounds Function Bounds(aLeft, aTop, aWidth, aHeight: Integer): TRect;
Bounds(X, Y, W, H) is equivalent to Rect(X, Y, X+W, Y+H).

How can I have a TBitBtn component that has word-wrapped caption?
(FAQ 1754D)
RestrictCursor.Txt
Classes
ClientToScreen Small bitmaps in a TPopUpMenu (FAQ 1806D) Windows
Clipboard Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr Clipbrd
CMYK Function CMYK(c, m, y, k: Byte): COLORREF;
Similar to RGB function but for CMYK color coordinates.
Windows
ColorRef
TColorRef
DWORD in D4 (in D3 ColorRef is DWORD, TColorRef is LongInt) Windows
ColorToIdent Function ColorToIdent(Color: Longint; var Ident: string): Boolean;

Examples:
ColorToIdent(clBtnFace,s) will return TRUE with s = 'clBtnFace';
ColorToIdent($00234567,s)
will return FALSE with s = '';
Graphics
ColorToRGB Function ColorToRGB(Color: TColor): Longint;
When Color is negative (e.g., clBtnFace, clMenu, clWindow) ColorToRGB calls GetSysColor API call to get RGB values from the  index.  Use the ColorToRGB function to convert Win32 system colors, such as clWindow, to a valid RGB color.

VAR Color: Integer;
...
Color := ColorToRGB(clAqua);
ShowMessage(IntToStr(GetRValue(Color)) + ' ' +
            IntToStr(GetGValue(Color)) + ' ' +
            IntToStr(GetBValue(Color)));

Converting a TColor value to a HTML color string (FAQ 1878D)

Graphics
ColorToString Function ColorToString(Color: TColor): String; 

Examples:
ColorToString(clBtnFace) will return 'clBtnFace';
ColorToString($00234567)
will return '$00234567';

Converting a color to its VCL string value (FAQ 836D)
Graphics
CopyRect Function CopyRect(var lprcDst: TRect; const lprcSrc: TRect): BOOL; stdcall; Windows
GetBValue
GetGValue
GetRValue
Function GetBValue(rgb: DWORD): Byte;
Function GetGValue(rgb: DWORD): Byte;
Function GetRValue(rgb: DWORD): Byte;

(seems like the DWORDs should be COLORREFs?)

VAR Color: Integer;
...
Color := ColorToRGB(clAqua);
ShowMessage(IntToStr(GetRValue(Color)) + ' ' +
            IntToStr(GetGValue(Color)) + ' ' +
            IntToStr(GetBValue(Color)));

Retrieve the blue, green or red color intensity value from the color specifier.
Extracting RGB components of a color (FAQ 2744D)

In D3 a DWORD is an Integer, but in D4 a DWORD is a LongWord.   A value of -1 now creates a Range Check Error in D4, which is returned by Canvas.Pixels when the property is undefined like when a TBitmap is created without any assignment to Width or Height.

Windows
GetColorValues procedure GetColorValues(Proc: TGetStrProc); Graphics
GetCValue
GetMValue
GetYValue
GetKVAlue
Function GetCValue(cmyk: COLORREF): Byte;
Function GetMValue(cmyk: COLORREF): Byte;
Function GetYValue(cmyk: COLORREF): Byte;
Function GetKValue(cmyk: COLORREF): Byte;

These Windows functions appear to be for CMYK color coordinates, but they assume your COLORREF contains CMYK.  See UseNet Post by Flavius Vespasianus that explain these functions do no conversions.

Windows
GraphicExtention Returns default filename extension of a graphics object. Graphics
GraphicFileMask Returns mask string that specifies valid extensions for a graphic class. Graphics
GraphicFilter Obtain value for Filter property of an Open Picture or Save Picture dialog.
See Magnifier for one example.
Graphics
hInstance Instance handle of the application (or library) provided by Windows environment. System
IdentToColor Function IdentToColor(const Ident: string; var Color: Longint): Boolean; Graphics
MulDiv Useful function for defining integer graphics locations in a device-independent way. Example: If you treat an Image as if its coordinates ranged from 0.0 to 1.0 in both the X and Y dimensions, the point 1/4-th from the left and 3/4-ths from the top is:

Point1 := Point( MulDiv(Image.Width, 1, 4), MulDiv(Image.Height,3,4) );
Windows
OffsetRect Function OffsetRect(var lprc: TRect; dx, dy: Integer): BOOL; stdcall;

How can I have a TBitBtn component that has word-wrapped caption?
(FAQ 1754D)
Windows
PaletteIndex Function PaletteIndex(i: Word): COLORREF;
BEGIN
  Result := $01000000   OR   i
END;


The color specifier will be in the form $010000nn.   The low-order byte represents an index into the currently realized logical palette.    Also see RGB, PaletteRGB,
Windows
PaletteRGB Function PaletteRGB(r, g, b: Byte): COLORREF;
BEGIN
  Result := $02000000  OR  RGB(r,g,b);
END;


The color specifier will be in the form $02bbggrr.   Windows locates the palette entry that most closely matches the color determined by the R, G and B components of the three low-order bytes.  Also see PaletteIndex, RGB,

The PaletteRGB function sets the high byte of the colour to $02. To get the nearest color use the GetNearestPaletteIndex API function.

Windows
Point Function Point(AX, AY: Integer): TPoint;
Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr
Classes
PointToSmallPoint Function PointToSmallPoint(const P: TPoint): TSmallPoint; Windows
Printer See efg's Delphi Printing Info and Links page. Printers
Rect Function Rect(ALeft, ATop, ARight, ABottom: Integer): TRect; Classes
bookmark.gif (183 bytes) RGB Function RGB(r, g, b: Byte): COLORREF;
BEGIN
  Result   :=   (r OR (g SHL 8) OR (b SHL 16))
END;


The color specifier will be in the form $00bbggrr.   The low-order three bytes contain relative intensity values for blue, green and red components of the color.  If necessary, the color specifier will result in a color generated by dithering the 20 static colors to create the closest approximation to the requested color.  

Also see the PaletteIndex, PaletteRGB, and   CMYK functions.
Color problems in 256 color mode (FAQ 2780D)
How do I convert a color to a shade of gray? (FAQ 2728D)
Windows
Screen How to create a custom cursor
How to set/reset the Screen.Cursor
How to restrict cursor to specified rectangular area
Using an animated cursor (FAQ 580D)
Loading Bitmaps and Cursors from RES Files (TI 1081D)
Loading a Custom Cursor from a RES file (TI 1075D)

How to Create BMP files for Standard Cursors
(also includes list of Standard Cursor definitions)
see  Cursors on efg's Delphi Graphics Algorithm page

Adding your own cursors to the application
www.openinfo.se/martin/texterdelphi/cursorsex.htm

TScreen.Cursors
http://arthur.smith.net/tips/tip31.html

PixelsPerInch:  Checking for large fonts, www.preview.org/q/q1020.shtml

Forms
SmallPoint Function SmallPoint(AX, AY: SmallInt): TSmallPoint; Classes
SmallPointToPoint Function SmallPointToPoint(const P: TSmallPoint): TPoint; Windows
StringToColor Function StringToColor(Const S: String): TColor;
Converting a color to its VCL string value (FAQ 836D)
Graphics
TBitmapInfo
TBitmapInfoHeader
Sending an image to the printer (FAQ  1211D)
("NOT" missing in second sentence of Answer?)
Windows
TPoint TPoint =
RECORD
  x: Longint;
  y: Longint;
END;
Windows
TRect TRect =
RECORD
  CASE Integer OF
    0: (Left, Top, Right, Bottom: Integer);
    1: (TopLeft, BottomRight: TPoint);
END;

Rectangles:  A Closer Look at the TRect Windows Data Type.  (CopyRect, InflateRect, IntersectRect, IsRectEmpty, OffsetREct, Rect, SetRect, SetRectEmpty,  SubtractRect, UnionRect, ScreenToClient, ClientToScreen, pRect, ClipCursor), Delphi Informant, Aug. 1999.

Windows
TRGBQuad Useful when working with pf32bit scanlines. The rgbReserved field is often called the "alpha" channel (especially in the Mac world). The alpha channel is used by some applications to pass grayscale mask information.

TRGBQuad =
PACKED RECORD
  rgbBlue : Byte;
  rgbGreen: Byte;
  rgbRed  : Byte;
  rgbReserved: Byte;
END;


See TBitmap, Scanline Property (above) for how to use an array of TRGBQuad when working with pf32bit scanlines.
Windows
TRGBTriple Useful when working with pf24bit Scanlines:

TRGBTriple =
PACKED RECORD
  rgbtBlue : Byte;
  rgbtGreen: Byte;
  rgbtRed  : Byte;
END;


See TBitmap, Scanline Property (above) for how to use an array of TRGBTriple when working with pf24bit scanlines.
Windows
TSmallPoint TSmallPoint =
RECORD
  x: SHORT;
  y: SHORT;
END;
Windows

Links Verified 26 Mar 2000
Updated 26 Feb 2005


since 1 Nov 1998