我也没有发现,只有借助于一个临时的stringlist然后进行删除了。
要么下载一个增强的控件

解决方案 »

  1.   

    我想你用stringgrid,那么数据量可能不大,那就做个过程用循环硬搞!
      

  2.   

    stringGrid过于简单,建议你放弃他
      

  3.   

    最苯的方法:确定要删除的行,将其后的行依次上移最后将StringGrid的行数减一了。
      

  4.   

    http://www.delphi3000.com/articles/article_1528.asp
    去这个站点看看
      

  5.   

    干脆我给你Cut出来;你应该到哪里看看
    You can always use a DBGrid to display a Query Result, but if you don´t need the overhead of data aware components, you can use the following function to populate a StringGrid with the result of a SQL sentence. 
    Answer:
    Procedure QueryGrid(DBName, Statement: String; Target: TStringGrid; Titles: Boolean); 
    Var Col,  Lin:  Integer; 
    begin 
      With TQuery.Create(Nil) Do 
      Try 
        DatabaseName := DBName; 
        SQL.Text := Statement; 
        Open; 
        If Not IsEmpty Then 
        Begin 
          Target.ColCount := FieldCount; 
          Target.RowCount := RecordCount+ IIF(Titles,1,0); 
          Target.FixedCols := 0; 
          Target.FixedRows := IIF(Titles,1,0); 
          If Titles Then 
            For Col := 0 To FieldCount-1 Do 
              Target.Cells[Col,0] := Fields[Col].FieldName; 
          Lin := 0; 
          While Not Eof Do 
          Begin 
            For Col := 0 To FieldCount-1 Do 
              Target.Cells[Col,Lin+Target.FixedRows] := 
                     Fields[Col].AsString; 
            Next; 
            Inc(Lin); 
          End; 
        End; 
      Finally 
        Close; 
        Free; 
      End; 
    end; { QueryGrid }  
      

  6.   

    各位,这个问题我已经解决了,方法嘛,既然不能删除一行,那么我就将这一行隐藏起来,即设置这一行的高度为0(RowHeights[I]:=0),这样在过滤时就可以保留所有数据,而取消过滤时只要遍历所有的行并重新设置行高即可。实践证明此方法速度最快,不过当连续删除相邻行时,由于网格之间还有间隔(当然,不要间隔也行,不过我觉得太难看),会留下高度不等的色块,所以我最后将高度设为-1,虽然也不是很完美,但比设置为0效果要好,大家可以试试。
      

  7.   

    去www.tmssoftware.com下载一个advstringgridTadvstainggrid.removerowex(rowindex,rowcount)
      

  8.   

    我的办法没有上述缺陷,我已在机器上实现,要源码发邮件给我。
    E-mail:[email protected]