procedure TShortageGoodsFrm.StringGrid1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
{$J+}
const
  vOldCol:Integer = -1;
  {$J-}
var
  vCol, vRow:Integer;
begin
  if Button = mbRight then Exit;
  TStringGrid(Sender).MouseToCell(X, Y, vCol, vRow);
  if (vRow < 0) or (vRow >= TStringGrid(Sender).FixedRows) then Exit;
  StringGridRowSort(TStringGrid(Sender), vCol, vOldCol = vCol);
  if vOldCol = vCol then
    vOldCol := -vOldCol  else vOldCol := vCol;

解决方案 »

  1.   

    StringGrid的排序,StringGridRowSort为自定义排序函数,非标准函数
      

  2.   


    procedure TShortageGoodsFrm.StringGrid1MouseDown(Sender: TObject; 
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 
    {$J+} 
    const 
      vOldCol:Integer = -1; 
      {$J-} 
    var 
      vCol, vRow:Integer; 
    begin 
      if Button = mbRight then Exit; 
      TStringGrid(Sender).MouseToCell(X, Y, vCol, vRow); 
      if (vRow < 0) or (vRow >= TStringGrid(Sender).FixedRows) then Exit; 
      StringGridRowSort(TStringGrid(Sender), vCol, vOldCol = vCol); 
      if vOldCol = vCol then 
        vOldCol := -vOldCol 
      else vOldCol := vCol;还要怎么具体啊,哪里不清楚啊!