加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

全局探色器

发布时间:2020-12-15 07:52:27 所属栏目:Java 来源:网络整理
导读:? 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); pro

?

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读