zoukankan      html  css  js  c++  java
  • 根据颜色值获取颜色常量名: ColorToIdent

    本例效果图:



    代码文件:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ComCtrls;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        ColorDialog1: TColorDialog;
        procedure Button1Click(Sender: TObject);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      c: Integer;
      s: string;
    begin
      if ColorDialog1.Execute then c := ColorDialog1.Color;
    
      ColorToIdent(c, s);
    
      if s = '' then s := ColorToString(c);
      Color := c;
      Text := s;
    end;
    
    end.
    
    窗体文件:
    object Form1: TForm1
      Left = 0
      Top = 0
      Caption = 'Form1'
      ClientHeight = 262
      ClientWidth = 220
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      Position = poDesktopCenter
      PixelsPerInch = 96
      TextHeight = 13
      object Button1: TButton
        Left = 72
        Top = 104
        Width = 75
        Height = 25
        Caption = 'Button1'
        TabOrder = 0
        OnClick = Button1Click
      end
      object ColorDialog1: TColorDialog
        Left = 96
        Top = 24
      end
    end
    
  • 相关阅读:
    LINQ基础——WHERE子句
    LINQ基础——LET子句
    LINQ基础——FROM子句
    Guid(全局统一标识符)
    ??运算符
    多线程的AutoResetEvent
    线程池(ThreadPool)
    Mutex
    Monitor类实现线程同步
    【java框架】MyBatis(7)--MyBatis注解开发
  • 原文地址:https://www.cnblogs.com/del/p/1323157.html
Copyright © 2011-2022 走看看