目的:要在某个cell获得焦点后双击鼠标,在屏幕双击位置生成一个无标题栏的小窗体。1.主要是这个双击位置怎么来定,正好在双击的位置?
2.stringgrid的焦点是哪个虚线的吗?能不能再弄的更醒目点???

解决方案 »

  1.   

    问题一:
    procedure TForm1.StringGrid1DblClick(Sender: TObject);
    var
      p : TPoint;
    begin
      GetCursorPos(p);  Form2 := TForm2.Create(nil);
      try
         Form2.Left := p.X;
         Form2.Top := p.y;
         Form2.ShowModal;
      finally
        Form2.Free;
      end;
    end;问题二。没看懂
      

  2.   

    ...问题2就是把stringgrid的那个可以移动的虚线框颜色改下可以吗?
      

  3.   

    第二个问题procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      with (Sender as TStringGrid).Canvas do 
      begin
        Pen.Color := clBlue; //蓝色画横线
        MoveTo(Rect.Left, Rect.Bottom); 
        LineTo(Rect.Right, Rect.Bottom);     Pen.Color := clGreen; //绿色画竖线
        MoveTo(Rect.Right, Rect.Top); 
        LineTo(Rect.Right, Rect.Bottom);
      end;
    end;
      

  4.   

    晕,你画的是里面的线,我说的是stringgrid里面用键盘可以移动的那一个虚线单元框的颜色