unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, Graphics,
Grids, ExtCtrls;type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
private
{ Private declarations }
FDraw: array of boolean;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
SetLength(FDraw, StringGrid1.RowCount);
end;procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
i: integer;
begin
for i := 1 to StringGrid1.RowCount - 1 do
if FDraw[ARow] and (ACol = 3) and (ARow <> i) then
StringGrid1.Canvas.Draw(Rect.Left, Rect.Top, Image1.Picture.Graphic);
end;procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var
ARect: TRect;
begin
with StringGrid1 do
begin
ARect := CellRect(ACol, ARow);
if (ARow <>0) and (ACol <> 0) then
if not FDraw[ARow] then
begin
Canvas.Draw(ARect.Left, ARect.Top, Image1.Picture.Graphic);
FDraw[ARow] := true;
end
else begin
Canvas.Draw(ARect.Left, ARect.Top, nil);
FDraw[ARow] := false;
end;
end;
end;end.
Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, Graphics,
Grids, ExtCtrls;type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
private
{ Private declarations }
FDraw: array of boolean;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
SetLength(FDraw, StringGrid1.RowCount);
end;procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
i: integer;
begin
for i := 1 to StringGrid1.RowCount - 1 do
if FDraw[ARow] and (ACol = 3) and (ARow <> i) then
StringGrid1.Canvas.Draw(Rect.Left, Rect.Top, Image1.Picture.Graphic);
end;procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var
ARect: TRect;
begin
with StringGrid1 do
begin
ARect := CellRect(ACol, ARow);
if (ARow <>0) and (ACol <> 0) then
if not FDraw[ARow] then
begin
Canvas.Draw(ARect.Left, ARect.Top, Image1.Picture.Graphic);
FDraw[ARow] := true;
end
else begin
Canvas.Draw(ARect.Left, ARect.Top, nil);
FDraw[ARow] := false;
end;
end;
end;end.
解决方案 »
- 谁有intraweb关于B/S数据库访问开发这方面的资料
- Borland问题,还是我的问题?
- 求改注册表限制用户只能用100次的代码 (加急在线中)!!!
- TMSCOMM在DELPHI5下是和GPS通讯的一个组件,在DELPHI7对应的是那个控件,在什么具体位置
- Delphi中调用VC中的类.在线等...急!解决立刻给分!
- 子系统架构问题
- 请问:和DBGrid连接的数据源改变时,如何实现DBGrid的刷新?
- 请问谁知道哪里有dxdbgrid for delphi7下载?
- 如何在DELPHI的datetimepicker控件中输入时间空值??
- 那里有installshield的使用方法,谢谢
- 请问delphi数据库如何入门,最好用MSSQL.
- 转贴:关于C/C++与Pascal分割的讨论(sheve)
BTW:本想送100分的,哪知道系统最多只允许27,没办法了,下次补上