procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1 do
begin
Canvas.Pen.Color := clRed;
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(Rect);
if gdSelected in State then
begin
Canvas.Brush.Color := clBlue;
Canvas.Brush.Style := bsSolid;
Canvas.FillRect(Rect);
end;
end;
end;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1 do
begin
Canvas.Pen.Color := clRed;
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(Rect);
if gdSelected in State then
begin
Canvas.Brush.Color := clBlue;
Canvas.Brush.Style := bsSolid;
Canvas.FillRect(Rect);
end;
end;
end;
解决方案 »
- 【清明】之四,闻春雷
- 如何合并stringgrid的单元格,在合并格子里输入文字能居中
- 关于ADOTable的onCalcFields事件的执行
- DELPHI发邮件,连接邮件服务器成功,但发MAIL时生成220错误
- 菜鸟问题!
- 一个简单的sql查询的问题(100)
- 在哪能下载到DELPHI的一些第三方控件啊!分分,乱飞了!
- sql中的where部分改为adodataset的filter竟然出错!
- 如何建立带参数的Form1, 如:Form1:=Tform1(参数1,参数2)?
- getmem的用法?再次提问!
- 急!各位大侠请问如何打开dat后缀的数据文件!100分奉送!!!!
- 一个送分的简单小问题,大家快来拿,100分大派送!!
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1 do
begin
Canvas.FillRect(Rect);
Canvas.Pen.Color := clRed;
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(Rect);
if gdSelected in State then
begin
Canvas.Brush.Color := clBlue;
Canvas.FillRect(Rect);
end;
Canvas.Font.Color := clRed;
DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, Rect, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
end;
end;