가능합니다.
방법1.
Panel의 Caption을 지우고
Panel위에 TLabel을 올리세요
Label->Caption="첫째줄\r\n둘째줄";
뭐 이런식으로 쓰면 됩니다.
근데 이걸 원하시는게 아니셨죠?
방법2.
일단 TPanel의 기능만으로는 안됩니다.
왜냐하면
TPanel의 조상인 TCustomPanel의 Paint 함수에 보면
DrawText할때 영역의 높이를 char 하나 높이만 설정해주거든요
//TCustomPanel.Paint 함수의 일부분...
...
with Canvas do
begin
if not ThemeServices.ThemesEnabled or not ParentBackground then
begin
Brush.Color := Color;
FillRect(Rect);
end;
Brush.Style := bsClear;
Font := Self.Font;
FontHeight := TextHeight('W'); //이부분에서....
with Rect do
begin
Top := ((Bottom + Top) - FontHeight) div 2;
Bottom := Top + FontHeight;
end;
Flags := DT_EXPANDTABS or DT_VCENTER or Alignments[FAlignment];
Flags := DrawTextBiDiModeFlags(Flags);
DrawText(Handle, PChar(Caption), -1, Rect, Flags); //실제로 Text를 그려주는 부분
end;
그러므로 결론적으로 TPanel의 Paint 함수를 새로 만들어서
FontHeight 계산부분만 수정해주시면 될듯...
그럼...
열씨미 님이 쓰신 글 :
: 제목 그래로 입니다.
: Panel 의 Caption 에 글자 두줄로 쓸수 있나요...
|