C
cooldren
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TMainFrm.dxDBGridCustomDrawColumnHeader(Sender: TObject;
AColumn: TdxTreeListColumn; ACanvas: TCanvas; ARect: TRect;
var AText: String; var AColor: TColor; AFont: TFont;
var AAlignment: TAlignment; var ASorted: TdxTreeListColumnSort;
var ADone: Boolean);
var
X, Y: Integer;
CustomDrawRgn: TdxCustomDrawRegion;
begin
CustomDrawRgn := TdxCustomDrawRegion.Create(ACanvas.Handle, ARect);
try
PaintImageTiled(ACanvas, ARect, Image2.Picture.Bitmap);
// ACanvas.Font.Size := 11;
X := ARect.Left + 5;
Y := ARect.Top + (ARect.Bottom - ARect.Top - ACanvas.TextHeight(AText)) div 2;
ACanvas.Brush.Color := clBtnFace;
ACanvas.Brush.Style := bsClear;
ACanvas.TextRect(ARect, X + 3, Y + 3, AText);
[red]// AColumn.HeaderAlignment:=taCenter;
// 上面这一句不行[/red]
DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_TOPLEFT);
DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDOUTER, BF_BOTTOMRIGHT);
finally
CustomDrawRgn.Free;
end;
ADone := True;
end;
AColumn: TdxTreeListColumn; ACanvas: TCanvas; ARect: TRect;
var AText: String; var AColor: TColor; AFont: TFont;
var AAlignment: TAlignment; var ASorted: TdxTreeListColumnSort;
var ADone: Boolean);
var
X, Y: Integer;
CustomDrawRgn: TdxCustomDrawRegion;
begin
CustomDrawRgn := TdxCustomDrawRegion.Create(ACanvas.Handle, ARect);
try
PaintImageTiled(ACanvas, ARect, Image2.Picture.Bitmap);
// ACanvas.Font.Size := 11;
X := ARect.Left + 5;
Y := ARect.Top + (ARect.Bottom - ARect.Top - ACanvas.TextHeight(AText)) div 2;
ACanvas.Brush.Color := clBtnFace;
ACanvas.Brush.Style := bsClear;
ACanvas.TextRect(ARect, X + 3, Y + 3, AText);
[red]// AColumn.HeaderAlignment:=taCenter;
// 上面这一句不行[/red]
DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDINNER, BF_TOPLEFT);
DrawEdge(ACanvas.Handle, ARect, BDR_RAISEDOUTER, BF_BOTTOMRIGHT);
finally
CustomDrawRgn.Free;
end;
ADone := True;
end;