在你的StringGrid的OnMouseDown事件里写上以下代码:procedure TForm1.StringGrid1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
Col,Row: integer;
myRect: TGridRect;
begin
StringGrid1.MouseToCell(X, Y, Col, Row);
if Col = 0 then
begin
myRect.Left := 1;
myRect.Top := Row;
myRect.Right := StringGrid1.ColCount;
myRect.Bottom := Row;
StringGrid1.Selection := myRect;
end;
end;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
Col,Row: integer;
myRect: TGridRect;
begin
StringGrid1.MouseToCell(X, Y, Col, Row);
if Col = 0 then
begin
myRect.Left := 1;
myRect.Top := Row;
myRect.Right := StringGrid1.ColCount;
myRect.Bottom := Row;
StringGrid1.Selection := myRect;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货