编程中,我想让数据区的某几行的边界线去除,其余行正常实现。而控件只有一个GridLineWidth(等于0时,所有的边界都没了)。我想自己定义个控件,按行去除 gridline (实在不行的话,GridLineWidth能够分行列也行),这种想法复杂吗?具体如何实现,跪求牛人。对了,在ondrawcell里重绘的方法就不要说了,我的stringgrid单元比较多,几百列,重绘太慢,有闪烁。

解决方案 »

  1.   

    既然不许在ondrawcell里重绘,就用两个组件拼接好了。
      

  2.   

    问题自己解决了。
    新问题:我在stringgrid 的onkeydown中相应 方向向上、向下。结果方向向下相应两次,这时为什么?
     if (Key = VK_UP)  then
      begin
        StringGrid1.SetFocus;
        if  StringGrid1.Row=6 then
          StringGrid1.Row := 1;  end;  if (Key = VK_DOWN)  then
      begin
        StringGrid1.SetFocus;
        if  StringGrid1.Row=1 then
          StringGrid1.Row := 6;  end; 
      

  3.   

    补充:程序中,我让 2、3、4、5不能选中,以上代码实现的功能就是实现在行 1 、6、7间自由UP\DOWN
      

  4.   

    让焦点在1、6行中跳:
    procedure TForm1.StringGrid1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if Key=VK_UP then
      begin
        if StringGrid1.Row=6 then begin
          Key:=0;
          StringGrid1.Row:=1;
        end;
      end
      else if Key=VK_DOWN then
      begin
        if StringGrid1.Row=1 then begin
          Key:=0;
          StringGrid1.Row := 6;
        end;
      end;
    end;