//StringGrid网格点击标题画线事件(sGrid: 网格) procedure TFmBestBusiAnalyse.Sgrd_QualityMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var ACol, ARow :Integer; OldColumnIndex :Integer; begin with sGrid do begin MouseToCell(X,Y,ACol,ARow); if not (Button =mbLeft) then Exit; if (ARow >= FixedRows) or (ARow < 0) then Exit; Canvas.Pen.Color :=clGray; Canvas.MoveTo(CellRect(ACol,0).Left,0); Canvas.LineTo(CellRect(ACol,0).Right,0); Canvas.MoveTo(CellRect(ACol,0).Left,0); Canvas.LineTo(CellRect(ACol,0).Left,CellRect(ACol,0).Bottom); Canvas.Pen.Color :=clBtnFace; Canvas.MoveTo(CellRect(ACol,0).Left,CellRect(ACol,0).Bottom-1); Canvas.LineTo(CellRect(ACol,0).Right,CellRect(ACol,0).Bottom-1); Canvas.MoveTo(CellRect(ACol,0).Right-1,0); Canvas.LineTo(CellRect(ACol,0).Right-1,CellRect(ACol,0).Bottom); end; end;procedure TFmBestBusiAnalyse.Sgrd_QualityMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var ACol, ARow :Integer; begin inherited; with Sgrd_Quality do begin MouseToCell(X,Y,ACol,ARow); if (ARow >= FixedRows) or (ARow < 0) then Exit; Invalidate; try sTitleClick(Sgrd_Quality,ACol,2); //标题排序事件 except end; end; end;
procedure TFmBestBusiAnalyse.Sgrd_QualityMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
ACol, ARow :Integer;
OldColumnIndex :Integer;
begin
with sGrid do
begin
MouseToCell(X,Y,ACol,ARow);
if not (Button =mbLeft) then
Exit;
if (ARow >= FixedRows) or (ARow < 0) then
Exit;
Canvas.Pen.Color :=clGray;
Canvas.MoveTo(CellRect(ACol,0).Left,0);
Canvas.LineTo(CellRect(ACol,0).Right,0);
Canvas.MoveTo(CellRect(ACol,0).Left,0);
Canvas.LineTo(CellRect(ACol,0).Left,CellRect(ACol,0).Bottom);
Canvas.Pen.Color :=clBtnFace;
Canvas.MoveTo(CellRect(ACol,0).Left,CellRect(ACol,0).Bottom-1);
Canvas.LineTo(CellRect(ACol,0).Right,CellRect(ACol,0).Bottom-1);
Canvas.MoveTo(CellRect(ACol,0).Right-1,0);
Canvas.LineTo(CellRect(ACol,0).Right-1,CellRect(ACol,0).Bottom);
end;
end;procedure TFmBestBusiAnalyse.Sgrd_QualityMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
ACol, ARow :Integer;
begin
inherited;
with Sgrd_Quality do
begin
MouseToCell(X,Y,ACol,ARow);
if (ARow >= FixedRows) or (ARow < 0) then
Exit;
Invalidate;
try
sTitleClick(Sgrd_Quality,ACol,2); //标题排序事件
except
end;
end;
end;