stringgridに縦書きをさせたくて、下記のコードをネットから拾いました。
快適に動いています。
更に希望ですが、特定の行のみフォントの大きさを変えたいのですが。
「GetObject」を理解できないほどのレベルですが。
簡単にできないでしょうか?
procedure TForm2.StringGrid1DrawCell(Sender: TObject; ACol, ARow:
Integer; Rect: TRect; State: TGridDrawState);
procedure
VerticalTextDraw(S: String);
var
LF:
TLogFont;
I: Integer;
begin
GetObject(StringGrid1.Canvas.Font.Handle,SizeOf(LF),
@LF);
LF.lfEscapement :=
-900;
StringGrid1.Canvas.Font.Handle :=
CreateFontIndirect(LF);
I := ((Rect.Right -
Rect.Left) div 2 +
StringGrid1.Canvas.TextWidth('W'));
StringGrid1.Canvas.TextOut(Rect.Left + I, Rect.Top + 5,
S);
end;
begin
StringGrid1.Canvas.FillRect(Rect);
VerticalTextDraw(StringGrid1.Cells[ACol,ARow]);
end;
よろしく、お願いします。
佐々木義照。