E
exam
Unregistered / Unconfirmed
GUEST, unregistred user!
在StringGrid上点中一个cell时,在cell底下画一条自左向右的线
当colcount*defaultcolwidth <= stringgrid.width
(也就是不能出现水平滚动条)时可以实行,大于时
就不行,怎么办呀!怎么办呀!!
图示
1 cell 1
1-------------------------------------------1
1 1
我写的代码
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
StringGrid1.Invalidate;
end;
procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
DownRect,lastRect : TRect;
begin
with stringgrid1 do
begin
DownRect := cellRect(Col,Row) ;
lastRect := cellrect(colcount-1,row);
canvas.moveto(0,DownRect.Bottom);
canvas.lineto(lastRect.right,DownRect.Bottom);
end;
end;
当colcount*defaultcolwidth <= stringgrid.width
(也就是不能出现水平滚动条)时可以实行,大于时
就不行,怎么办呀!怎么办呀!!
图示
1 cell 1
1-------------------------------------------1
1 1
我写的代码
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
StringGrid1.Invalidate;
end;
procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
DownRect,lastRect : TRect;
begin
with stringgrid1 do
begin
DownRect := cellRect(Col,Row) ;
lastRect := cellrect(colcount-1,row);
canvas.moveto(0,DownRect.Bottom);
canvas.lineto(lastRect.right,DownRect.Bottom);
end;
end;