Delphi Visual Component Library (VCL) Graphics
Components
(
Bookmark)
| 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. |
||||||||||
| 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);
|
||||||||||
| 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 |
||||||||||
| 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 Using Ampersands inside Delphi (FAQ 807D) Related: TransparentButton, pp. 290-292, How to Program
Delphi 3 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. |
||||||||||
| 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 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 |
||||||||||
| 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) |
||||||||||
| 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
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: Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr Q: How can I draw an ellipse without filling the inside? 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?" |
||||||||||
| 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. |
||||||||||
| 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."
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 |
||||||||||
| Rectangle | procedure
Rectangle(X1, Y1, X2, Y2: Integer);
New overload available in D5: Borland example: ..\Delphi n\Demos\Doc\GraphEx.dpr |
||||||||||
| 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. |
||||||||||
| 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); BitmapNew :=
TBitmap.Create; //
Shrink original bitmap to new size //
Display new, smaller bitmap |
|||||||||||
| 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: 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) | ||||||||||
| 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: The PaletteRGB function sets the high byte of the colour to $02. To get
the nearest color use the GetNearestPaletteIndex function. 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? StatusBars and ToolBars |
|||||||||
How to create a custom cursor How to Create BMP files for Standard Cursors CopyCursor (FAQ
1067D) 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 Dr. Bob's Tip: Right-Aligned T42Edit Right justification for numbers (Usenet post) Only numerical input in a TEdit Changing the Caret of a TEdit Prevent the TEdit Component from beeping when invalid (FAQ 759D) |
||||||||||
| TFileStream | Save and load metafiles in a BLOB field without using DBImage
(FAQ 878D) Also see File Stream I/O page |
||||||||||
| general info | Use bsClear Brush when writing text with a transparent background.
Delphi 3 or 4: ..\Demos\Ownerlst\FontDraw.DPR Antialiased Fonts Large Fonts Somewhere in the Display Settings (which can
vary by display adapter) there is a selection: 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 Dmitri Papichev's UseNet Post
with suggestions: David Barnard's UseNet Post and
design mode considerations Rotated Fonts TrueType Fonts Screen.Fonts and Printer.Fonts are TStrings lists of fonts that can How to Show Fonts in a ComboBox non-Delphi: |
||||||||||
| 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 | ||||||||||
| 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) Making Forms Work : Part II: Communicating Between
Forms Making Forms Work: Part III: Windows
Messages Making Forms Work: Part IV: Interaction and
Feedback Transparent Form Gruhn's Transparent Delphi App Shannon Broskie's UseNet Post
with DrawTitleBarImage function How can I create a transparent form? Changing the main form of an app. at runtime (FAQ 1695D) 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: Chapter 1, Delphi Programming Problem Solver by Neil Rubenking MDI 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 |
||||||||||
| 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) Delphi Pool TIcon Tips Yorai
Aminov's UseNet Post
about How to Convert hICON to TIcon |
||||||||||
| ReleaseHandle | Coliln Wilson UseNet Post about D4 TIcon Bug | ||||||||||
| 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. Sim Zacks' UseNet
Post about smooth image move How to determine the TImage graphic type at runtime How to move a TImage on a scrollbox Delphi Pool TImage Tips Eliminating flicker during a TImage move operation Builder C++ Example of Moving/Dragging TImage Array of TImages: efg's UseNet Post
Image.Picture.Graphic.Empty: |
||||||||||
| 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 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) Jim Hollenberg's UseNet Post to avoid certain TImageList problems by turning hardware graphics acceleration off Delphi Pool TImageList Tips The Basics of an ImageList |
|||||||||
| 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) 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) |
||||||||||
| Thread Sorting Demo Borland example: ..\Delphi n\Demos\Threads\ThrdDemo.DPR Steve Schafer's UseNet Post:
Delphi Pool TPaintBox Tips 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 On way to draw on a Panel's canvas:
|
||||||||||
| 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." |
||||||||||
| 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" |
||||||||||
| 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 The Patrician's UseNet
Post with PictureToBitmap function How can I place a bitmap in a metafile? (FAQ 1842D) Use a TPicture to load any registered file type into a TBitmap:
|
|||||||||||
| 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 |
||||||||||
| 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) 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 |
||||||||||
| 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) |
||||||||||
| 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 Peter Below's UseNet Post about how to print a treeview |
||||||||||
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; 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; Retrieve the blue, green or red color intensity value from the color specifier. 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 |
| 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 TScreen.Cursors 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