자유롭게 질의 및 응답을 할 수 있는 게시판입니다. 개발자 여러분의 답변이 큰 도움이 됩니다.
- 제품설치/등록 오류 문의: 설치/등록 Q&A 이용 (제품 구매 고객 한정)
Firemonkey [XE6] StringGrid의 정렬에 대한 자료를 찾았는데 컬럼의 색이 변합니다.
2014.11.18 00:59
procedure TForm1.StringGrid1DrawColumnCell(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF;
const Row: Integer; const Value: TValue; const State: TGridDrawStates);
const
HorzTextMargin = 2;
VertTextMargin = 1;
var
TextLayout : TTextLayout;
TextRect: TRectF;
begin
if Column = StringColumn1 then
begin
TextRect := Bounds;
TextRect.Inflate(-HorzTextMargin, -VertTextMargin);
Canvas.FillRect(Bounds, 0, 0, AllCorners, 1);
TextLayout := TTextLayoutManager.DefaultTextLayout.Create;
try
TextLayout.BeginUpdate;
try
TextLayout.WordWrap := False;
TextLayout.Opacity := Column.AbsoluteOpacity;
TextLayout.HorizontalAlign := StringGrid1.TextSettings.HorzAlign.tacenter;
TextLayout.VerticalAlign := StringGrid1.TextSettings.VertAlign;
TextLayout.Trimming := TTextTrimming.Character;
TextLayout.TopLeft := TextRect.TopLeft;
TextLayout.Text := Value.ToString;
TextLayout.MaxSize := PointF(TextRect.Width, TextRect.Height);
// TextLayout.Font.Family := 'Times New Roman';
// TextLayout.Font.Style := [ TFontStyle.fsBold ];
// TextLayout.Font.Size := 14;
TextLayout.Color := TAlphaColors.Red;
finally
TextLayout.EndUpdate;
end;
TextLayout.RenderLayout(Canvas);
finally
TextLayout.Free;
end;
end;
end;
해당컬럼의 색을 변하지 않게 하는 방법이 없나요 ??
댓글 0
Firemonkey [XE6] StringGrid의 정렬에 대한 자료를 찾았는데 컬럼의 색이 변합니다.
2014.11.18 00:59
procedure TForm1.StringGrid1DrawColumnCell(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF;
const Row: Integer; const Value: TValue; const State: TGridDrawStates);
const
HorzTextMargin = 2;
VertTextMargin = 1;
var
TextLayout : TTextLayout;
TextRect: TRectF;
begin
if Column = StringColumn1 then
begin
TextRect := Bounds;
TextRect.Inflate(-HorzTextMargin, -VertTextMargin);
Canvas.FillRect(Bounds, 0, 0, AllCorners, 1);
TextLayout := TTextLayoutManager.DefaultTextLayout.Create;
try
TextLayout.BeginUpdate;
try
TextLayout.WordWrap := False;
TextLayout.Opacity := Column.AbsoluteOpacity;
TextLayout.HorizontalAlign := StringGrid1.TextSettings.HorzAlign.tacenter;
TextLayout.VerticalAlign := StringGrid1.TextSettings.VertAlign;
TextLayout.Trimming := TTextTrimming.Character;
TextLayout.TopLeft := TextRect.TopLeft;
TextLayout.Text := Value.ToString;
TextLayout.MaxSize := PointF(TextRect.Width, TextRect.Height);
// TextLayout.Font.Family := 'Times New Roman';
// TextLayout.Font.Style := [ TFontStyle.fsBold ];
// TextLayout.Font.Size := 14;
TextLayout.Color := TAlphaColors.Red;
finally
TextLayout.EndUpdate;
end;
TextLayout.RenderLayout(Canvas);
finally
TextLayout.Free;
end;
end;
end;
해당컬럼의 색을 변하지 않게 하는 방법이 없나요 ??