📄 ugetbkcolor.pas
字号:
unit UGetBkColor;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
{if the background color is not red, make it so}
if GetBkColor(Canvas.Handle)<>clRed then
SetBkColor(Canvas.Handle, clRed);
{output some text. the background color will be used}
Canvas.TextOut(20, 20, 'Text with a background color');
{if the background mode is not transparent, make it so}
if GetBkMode(Canvas.Handle)<>TRANSPARENT then
SetBkMode(Canvas.Handle, TRANSPARENT);
{draw some text. the background color will not be used}
Canvas.TextOut(20, 40, 'Text drawn with a transparent background');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -