全局探色器

别说谁变了你拦得住时间么 提交于 2019-11-29 05:39:26

 

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
Edit1: TEdit;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Enabled := False;
Timer1.Interval := 100;
Button1.Default := True;
Button1.Caption := '用回车操作这个按钮';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled := not Timer1.Enabled;
if Timer1.Enabled then Button1.Caption := '开始'
else Button1.Caption := '停止';
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
pt: TPoint;
c: TColor;
begin
GetCursorPos(pt);
c := GetPixel(GetDC(0), pt.X, pt.Y);
Self.Color := c;
Edit1.Text := Format('$%.6x', [c]);
end;

end.

 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!