已经知道了TColor的值,怎么转换成RGB值 已经知道了TColor的值,怎么转换成RGB值? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 看看这个例子你就知道了:procedure TForm1.Button1Click(Sender: TObject);begin Form1.Canvas.Pen.Color := clRed; Memo1.Lines.Add('Red := ' + IntToStr(GetRValue(Form1.Canvas.Pen.Color))); Memo1.Lines.Add('Red := ' + IntToStr(GetGValue(Form1.Canvas.Pen.Color))); Memo1.Lines.Add('Blue := ' + IntToStr(GetBValue(Form1.Canvas.Pen.Color)));end; another way:var R, G, B: byte; s: string; col: TColor;begin s := IntToHex(col, 8); R := HexToInt(copy(s, 3, 2)); G := HexToInt(copy(s, 5, 2)); B := HexToInt(copy(s, 7, 2));end; TColor 2 RGB: function GetRValue(rgb: DWORD): Byte; function GetGValue(rgb: DWORD): Byte; function GetBValue(rgb: DWORD): Byte; 不是吧,用这么麻烦吗Delphi里面不是有函数ColorToRGB吗直接用这个函数不就可以了吗? Tidhttp控件post文件 用BDE的query查出数据后,为何不能 .edit? 请教怎么把数据库登录框去掉 若是SQL的数据库、Query的组件呢?好象没有LoginPrompt 属性???? 关于GDI+画出来的矢量图的显示问题? 一个菜鸟的问题! 关于屏幕刷新问题!急!! 请问谁知道Delphi关于网络和通讯方面编程的书?(比较好的) 不小心手工删除了kylix的目录就在也装不上了,咋办? 如何判斷一個Database在SQLServer中是否存在﹖ 大虾帮忙!急需大虾指点! 简单问题,搞定立即给分。(88) 关于报表打印总页数的问题
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Canvas.Pen.Color := clRed;
Memo1.Lines.Add('Red := ' +
IntToStr(GetRValue(Form1.Canvas.Pen.Color)));
Memo1.Lines.Add('Red := ' +
IntToStr(GetGValue(Form1.Canvas.Pen.Color)));
Memo1.Lines.Add('Blue := ' +
IntToStr(GetBValue(Form1.Canvas.Pen.Color)));
end;
R, G, B: byte;
s: string;
col: TColor;
begin
s := IntToHex(col, 8);
R := HexToInt(copy(s, 3, 2));
G := HexToInt(copy(s, 5, 2));
B := HexToInt(copy(s, 7, 2));
end;
function GetGValue(rgb: DWORD): Byte;
function GetBValue(rgb: DWORD): Byte;