我想在鼠标点击stringgrid的标题栏时,出现一效果,比如说,选择的一列标题栏凹下去当鼠标在stringgrid标题栏双击时,如何让它不响应stringgrid的双击事件

解决方案 »

  1.   

    //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;
      

  2.   

    上面的 sGrid 应改成 网格 Sgrd_Quality