在Stringgrid上,能够弹出右键菜单。点击右键菜单后,把要显示的内容显示在指定的Stringgrid的窗格中,如何实现

解决方案 »

  1.   

    procedure TForm1.PopupMenu1Popup(Sender: TObject);
    begin
      TStringGrid(PopupMenu1.PopupComponent).cells[0, 0] := '测试';
    end;
      

  2.   

    如果不是cells[0,0]呢。你这个只能显示在cells[0,0].我右键菜单动态移动后,相应得数据要显示在其他的表格中
      

  3.   

    procedure TForm1.StringGrid1MouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    var
      ACol, ARow: integer;
    begin
      if Button=mbRight then
      begin
        StringGrid1.MouseToCell(x, y, ACol, ARow);
        StringGrid1.cells[ACol, ARow] := '测试';
      end;
    end;