怎么让TStringGrid单元格的文字居中? 怎么让TStringGrid单元格的在单元格文字居中 ? 默认的是靠左上角对齐谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TFrmbzxx.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);var CellStr: String; Mode,CellLen: Integer;begin //①先清除CELL StringGrid1.Canvas.FillRect(Rect); CellStr := StringGrid1.Cells[ACol,ARow];//②根据文字長度自動調節列寛 CellLen := StringGrid1.Canvas.TextWidth(CellStr)+3; if (CellLen>StringGrid1.ColWidths[ACol]) then StringGrid1.ColWidths[ACol] := CellLen;//④文字排版 if ARow=0 then begin StringGrid1.Canvas.Font.Style :=[fsBold]; //可設定字体的顔色、大小 Mode := DT_CENTER //調整左右 end else begin StringGrid1.Canvas.Font.Color := clWindowText; Mode := DT_LEFT; Rect.Left := Rect.Left+2; //微調(使字不圧左側的線) end; Rect.Top := Rect.Top+3; //調整上下 DrawText(StringGrid1.Canvas.Handle,PChar(CellStr),Length(CellStr),Rect,Mode);end; AdvStringgrid使用 小问题,动态建窗体方面 用ADO时遇到的三个问题 请教:如何制作一个程序启动的窗体? 怎样安全有效的连接远程数据库??? 小问题,该怎么解决 如下截面如何设计请高手指点,谢谢! 怎样获得memo中所选文字的改变的事件? 如何重新编译Delphi本身的源码(Debug版和Release版)?例如Math.pas Login问题,我是新人! 我正在做一个餐饮软件,里面有关天厨房票据打印的,不知如何能得到票据打印机是否缺纸呢,很急的问题啊,我多给分. 关于Access数据库插入
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
CellStr: String;
Mode,CellLen: Integer;
begin
//①先清除CELL
StringGrid1.Canvas.FillRect(Rect);
CellStr := StringGrid1.Cells[ACol,ARow];
//②根据文字長度自動調節列寛
CellLen := StringGrid1.Canvas.TextWidth(CellStr)+3;
if (CellLen>StringGrid1.ColWidths[ACol]) then
StringGrid1.ColWidths[ACol] := CellLen;//④文字排版
if ARow=0 then begin
StringGrid1.Canvas.Font.Style :=[fsBold]; //可設定字体的顔色、大小
Mode := DT_CENTER //調整左右
end
else begin
StringGrid1.Canvas.Font.Color := clWindowText;
Mode := DT_LEFT;
Rect.Left := Rect.Left+2; //微調(使字不圧左側的線)
end;
Rect.Top := Rect.Top+3; //調整上下
DrawText(StringGrid1.Canvas.Handle,PChar(CellStr),Length(CellStr),Rect,Mode);end;