On my form i have only BitBtn4. For Form OnCreate event I've written:
procedure TForm1.FormCreate(Sender: TObject);
var S: AnsiString;
R: TRect;
begin
with BitBtn4 do
begin
S:=Caption;
Glyph.Canvas.Font := Self.Font;
Glyph.Width := Width - 6;
Glyph.Height := Height - 6;
R := Bounds(0, 0, Glyph.Width, 0);
Caption := '';
DrawText(Glyph.Canvas.Handle,PChar(S),Length(S),R,
DT_CENTER or DT_WORDBREAK or DT_CALCRECT);
OffsetRect(R,(Glyph.Width - R.Right) div 2,
(Glyph.Height - R.Bottom) div 2);
DrawText(Glyph.Canvas.Handle,PChar(S),Length(S),R,
DT_CENTER or DT_WORDBREAK);
end;
end;
But I saw a black rectangle. If I add Glyph.Mask(0);
I see text in white background, but characters have poor look.
..............
Glyph.Mask(0);
end;
end;
I need transparent background, well-look black multiline text and no black rectangle. I need a same look as TButton. How to do it?
If there is simpler way to do multiline caption in button - write me.