Font color Settings the same situation, as shown in figure, if the background color and cover color is different, word display effect also change
Looked at the Gauges. The code in the pas, use PaintText TextRect () function, is involved in this, how should this code into a DrawText function?
procedure TGauge. PaintAsText (AnImage: TBitmap; PaintRect: TRect);
Var
S: a string;
X, Y: Integer;
OverRect: TBltBitmap;
The begin
OverRect:=TBltBitmap. Create;
Try
OverRect. MakeLike (AnImage);
PaintBackground (OverRect);
S:=Caption;
//S=Format (' % d % % '[PercentDone]);
With OverRect. Canvas do
The begin
Brush. Style:=bsClear;
The Font:=the Self. The Font;
The Font Color:=clWhite;
With PaintRect do
The begin
X:=(Right - Left + 1 - TextWidth (S)) div 2;
Y:=(Bottom - Top + 1 - TextHeight (S)) div 2;
end;
TextRect (PaintRect, X, Y, S);
end;
AnImage. Canvas. CopyMode:=cmSrcInvert;
AnImage. Canvas. The Draw (0, 0, OverRect);
The finally
OverRect. Free;
end;
end;
CodePudding user response:
Text color is affected by the background color is normal, this is the principle of synthesis based on three primary colorsCodePudding user response: