我希望鼠标点击StringGrid的时候,不要出现焦点,即不要有蓝色或者虚线框

解决方案 »

  1.   

    option 里选 alwaysshowedit
      

  2.   

    呵呵,
    options里goAlwaysShowEditor:=true;
      

  3.   

    妖哥来也。
    在StringGrid的OnDrawCell事件中添加以下代码即可实现楼主想要的效果,不过感觉怪怪的。没有焦点的样子好不习惯。 -_-|||// 63 63 72 75 6E 2E 63 6F 6D
    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
        if gdSelected In State then
        begin
            StringGrid1.Canvas.Brush.Color := StringGrid1.Color;
            StringGrid1.Canvas.FillRect(Rect);
            StringGrid1.Canvas.Font.Color := clBlack;
            StringGrid1.Canvas.TextRect(Rect, Rect.Left + 2,
                    Rect.Top + 2, StringGrid1.Cells[ACol, ARow]);
        end;
        if gdFocused In State then
            StringGrid1.Canvas.DrawFocusRect(Rect);
    end;
      

  4.   

    用C用惯了,上面的代码可以用With,少打几个字。嘿嘿。