You are viewing articles in the Graphics category &rarr


How to Convert TColor to a Hex String and Vice Versa

Posted December 15th @ 9:12 pm by m3Rlin

Delphi uses TColor to represent colors but HTML requires a string name (139 colors have names in the web palette) or a hex number. Here’s the code to convert a TColor color value to hex a string and vise versa.
The functions use the Windows API GetRValue(), GetBValue(), GetGValue() and RGB() functions.
!Note: If your are going [...]

How to Stretch an Icon

Posted December 15th @ 9:09 pm by m3Rlin

Although Delphi’s StretchDraw() function should work for icons it doesn’t The way to get round this is to use the Windows API DrawIconEx() function.

(* iNewWidth - (Integer) New icon width
** iNewHeight - (Integer) New icon height
*)
DrawIconEx(Canvas.Handle, 0, 0, Icon.Handle, iNewWidth, iNewHeight, 0, 0, DI_NORMAL);

« Previous EntriesNext Entries »