fillcolor.pas

来自「delphi LED 显示屏用,带串口发送,内容编辑,演示功能」· PAS 代码 · 共 75 行

PAS
75
字号
unit fillcolor;

interface

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

type
  TFormfill = class(TForm)
    Panel1: TPanel;
    ComboBox2: TComboBox;
    ComboBox1: TComboBox;
    Label2: TLabel;
    Label3: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ComboBox1DrawItem(Control: TWinControl; Index: Integer;
      Rect: TRect; State: TOwnerDrawState);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    select:integer;
  end;

var
  Formfill: TFormfill;

const
   SCREENCOLOR:array[0..2] of int64=($ff,$ff00,$ffff);

implementation

{$R *.dfm}

procedure TFormfill.Button1Click(Sender: TObject);
begin
    select:=1;
    close;
end;


procedure TFormfill.Button2Click(Sender: TObject);
begin
    select:=0;
    close;
end;

procedure TFormfill.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var
     Arect:Trect;
begin
     Arect.Left:=rect.Left+5;
     Arect.Top:=rect.Top+2;
     Arect.Right:=rect.Left+25;
     Arect.Bottom:=rect.Bottom-2;
     ComboBox1.Canvas.Brush.color:=SCREENCOLOR[index];
     ComboBox1.Canvas.fillrect(Arect);
     ComboBox1.Canvas.Brush.color:=$ffffff;
     ComboBox1.Canvas.Font.Color:=0;
     ComboBox1.Canvas.TextOut(rect.left+30,rect.top,ComboBox1.items[index]);
end;

procedure TFormfill.FormCreate(Sender: TObject);
begin
     ComboBox1.ItemIndex:=0;
     ComboBox2.ItemIndex:=0;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?