指尖风暴 Typhon Finger

  • 首页
  • 公告
  • 新闻
  • 技术
  • 教学
  • 收藏
  • 下载
  • 博客
  • 商城
  • 购物车
  • 帐户
指尖风暴 TyphonFinger
日常技术笔记和技术输出~~~
  1. 首页
  2. 技术信息
  3. 正文

delphi之屏幕取色

2020-10-02 85点热度 0人点赞 0条评论

来源:http://www.delphitop.com/html/tuxiang/723.html

上个预览图先:

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.
本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: 暂无
最后更新:2020-10-02

指尖风暴

TyphonFinger

打赏 点赞
< 上一篇
下一篇 >

文章评论

您需要 登录 之后才可以评论

COPYRIGHT © 2022 指尖风暴 Typhon Finger. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang