怎么样使TStringGrid中的某列对齐? 怎么样使TStringGrid中的某列对齐(居中\居右或居左)? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 假设第2,4列右对齐,其他的左对齐procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);var Area: TRect;begin with StringGrid1, StringGrid1.Canvas do begin FillRect(Rect); Area:= Rect; InflateRect(Area, -2, -2); if (ACol=1) or (ACol=3) then DrawText(Handle, PChar(Cells[ACol, ARow]), Length(Cells[ACol, ARow]), Area, DT_RIGHT) else TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[ACol, ARow]); end;end; 占 lzy6204(畲族的DF) 的光。全部居中:procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);var Area: TRect; i:integer;begin with StringGrid1, StringGrid1.Canvas do begin FillRect(Rect); Area:= Rect; InflateRect(Area, -2, -2); for i:=0 to stringgrid1.RowCount-1 do DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_Center) end;end; 如何知道某个类型文件的默认打开程序是什么?编程从哪里可以知道? 一个关于FILTER的字符串问题.很急!!!!!!在线等!!!!!!!!!!1 如何用Timer组件来显示程序执行所花的时间?? fastreport免预览打印之迷惑 如何屏蔽要访问的远程服务器IP?求救!!! idftp下载文件前获取文件大小时出错 Edit的问题 程序自动退出,很奇怪的问题 如何将.BMP图片导入.DFM窗口格式文件中? Delphi之未经证实的葵花宝典下载了打不开怎么办?错误信息如下: 怎么样使TStringGrid的某列对齐? query.next问题,高分,急!!!!
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
Area: TRect;
begin
with StringGrid1, StringGrid1.Canvas do begin
FillRect(Rect);
Area:= Rect;
InflateRect(Area, -2, -2);
if (ACol=1) or (ACol=3) then DrawText(Handle, PChar(Cells[ACol, ARow]),
Length(Cells[ACol, ARow]), Area, DT_RIGHT)
else TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[ACol, ARow]);
end;
end;
全部居中:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
Area: TRect;
i:integer;
begin
with StringGrid1, StringGrid1.Canvas do begin
FillRect(Rect);
Area:= Rect;
InflateRect(Area, -2, -2);
for i:=0 to stringgrid1.RowCount-1 do
DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_Center)
end;
end;