博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
根据颜色值获取颜色常量名: ColorToIdent
阅读量:7175 次
发布时间:2019-06-29

本文共 1136 字,大约阅读时间需要 3 分钟。

  hot3.png

本例效果图:
26153000_4lxI.gif

代码文件:

unit Unit1;interfaceuses  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  endend

转载于:https://my.oschina.net/hermer/blog/319104

你可能感兴趣的文章
附上解决迅雷9及迅雷极速版任何资源下载任务出错、内容违规问题
查看>>
hadoop3: mkdir: cannot create directory `/usr/local/hadoop/bin/../logs’: Permission denied
查看>>
高阶函数与面向对象继承的比较
查看>>
群雄逐鹿的移动互联网时代【转载】
查看>>
【排序】InsertSort
查看>>
[c++11]多线程编程(五)——unique_lock
查看>>
高程3总结#第15章使用Canvas绘图
查看>>
【go并发编程】
查看>>
实验吧——隐写术之流
查看>>
Ionic 2 开发(一)_安装与目录结构
查看>>
浅谈内存泄露
查看>>
记录 xcode 配置build自增长
查看>>
用C#开发较完整的Windows任务管理器
查看>>
《Learning Scrapy》(中文版)第1章 Scrapy介绍
查看>>
单点登录原理与实现
查看>>
初探Java设计模式4:JDK中的设计模式
查看>>
漫谈promise使用场景
查看>>
Design Pattern的万剑归宗 => Mediator
查看>>
Javascript中的原型继承的一些看法与见解
查看>>
HackerRank:JavaScript 是最知名的编程语言
查看>>