zoukankan      html  css  js  c++  java
  • 屏幕取色

    代码:
    [code=delphi]
    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.[/code]

  • 相关阅读:
    tyvj1061Mobile Service
    POJ3666序列最小差值
    POJ2279杨氏矩阵+钩子定理
    POJ2127 LICS模板
    codevs2189数字三角形(%100)
    qhfl-7 结算中心
    qhfl-6 购物车
    qhfl-5 redis 简单操作
    qhfl-4 注册-登录-认证
    qhfl-3 Course模块
  • 原文地址:https://www.cnblogs.com/qiu18359243869/p/10318727.html
Copyright © 2011-2022 走看看