In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, comctrls; Type tform1 = Class (tform) button1: tbutton; coloralodig1: tcolordialog; Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.button1click (Sender: tobject); var C: integer; s: string; begin if colordialog1.execute then C: = colordialog1.color; colortoident (C, S ); if S = ''then S: = colortostring (c); color: = C; text: = s; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 262 clientwidth = 220 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = podesktopcenter pixelsperinch = 96 textheight = 13 object button1: tbutton left = 72 Top = 104 width = 75 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object colordialog1: tcolordialog left = 96 Top = 24 endend