微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

全局探色器

 

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐