如何控制Textout函数输出的文字的颜色和背景
我用以下代码来实现在屏幕上输出文字的功能,但不知道如何控制文字的颜色,还有,输出的文字的背景是白色的,要怎样才能使背景透明呢?
var
hScreenDC:HDC;
SystemTime: _SYSTEMTIME;
Temp: string;
MyOutput: PChar;
hfont:Cardinal;
begin
// while true do
begin
hFont:=CreateFont(170,90,0,0,8,0,0,0,DEFAULT_CHARSET,OUT_TT_PRECIS,CLIP_TT_ALWAYS,
PROOF_QUALITY ,DEFAULT_PITCH, '楷体 ');
hScreenDC := GetDC(0);
SelectObject(hScreenDC, hfont);
GetLocalTime(SystemTime);
TextOut(hScreenDC, 0,0, 'sdgagfdagfdg ',12);
ReleaseDC(0, hScreenDC);
DeleteObject(hFont)
end;
end;
[解决办法]
SetBKMode(hScreenDC,TRANSPARENT);
透明背景