Come with your heart (where the mouse passes can be taken)

zhaozj2021-02-17  49

Unit Ugetcor;

Interface

Uses Sysutils, Wintypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, ExtCtrls, buttons

type Tgetcol = class (TForm) Panel1: TPanel; Label1: TLabel; Label2: TLabel; procedure FormClick (Sender: TObject); procedure FormMouseMove (Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Panel1Click (Sender: TObject); procedure FormDblClick (Sender: TObject); procedure FormResize (Sender: TObject); private tx, ty: integer; procedure WMEraseBkng (var mSg: TWMEraseBkgnd); message WM_ERASEBKGND; public {public declarations} end;

Var getcol: Tgetcol; Implementation

{$ R * .dfm} const digits: array [0.. $ F] of char = '0123456789abcdef';

Function HEXB (B: BYTE): String; {-retHex String for Byte} Begin HEXB [0]: = # 2; HEXB [1]: = DIGITS [B Shr 4]; HEXB [2]: = DIGITS [B AND $ f]; end;

Procedure Tgetcol.wmeraseBkng (var msg: twmesebkgnd); begin msg.result: = 1;

Procedure Tgetcol.form (Sender: TOBJECT); VAR T: TCOLOR; R, G, B: BYTE; BEGINT: = Canvas.Pixels [TX, TY]; R: = GETGVALUE (T); g: = getGvalue (t) B: = getBValue (t); label2.color: = t; label1.caption: = '$ 00' HEXB (R) HEXB (g) HEXB (B); END

Procedure Tgetcol.FormMousemove (Sender: Tobject; Shift: TshiftState; x, y: integer); begintx: = x; type: = y;

Procedure tgetcol.panel1click (sender: TOBJECT); beginclose;

Procedure Tgetcol.formDBLClick (Sender: TOBJECT); beginclose;

Procedure tgetcol.formresize (sender: TOBJECT); beginpanel1.top: = height - panel1.height -1; panel1.left: = width - panel1.width -1; panel1.visible: = true; END;

End.

转载请注明原文地址:https://www.9cbs.com/read-30432.html

New Post(0)