怎样在STRINGGRID组件中加入COMBOBOX?

解决方案 »

  1.   

    ComboBox1.Visible := False;
    ComboBox1.Left := StringGrid1.Left + StringGrid1.CellRect(ACol, ARow).Left + 2;
    ComboBox1.Top := StringGrid1.Top + StringGrid1.CellRect(ACol, ARow).Top + 1;
    ComboBox1.Height := StringGrid1.RowHeights[ARow] + 3;
    ComboBox1.Width := StringGrid1.ColWidths[ACol] + 4;
    ComboBox1.Visible := True;
      

  2.   

    procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
      ARow: Integer; var CanSelect: Boolean);
    begin
      ComboBox1.Visible := False;
      ComboBox1.Top := StringGrid1.Top + StringGrid1.CellRect(ACol, ARow).Top + 1;
      ComboBox1.Left := StringGrid1.Left + StringGrid1.CellRect(ACol, ARow).Left + 2;
      ComboBox1.Height := StringGrid1.RowHeights[ARow] + 5;
      ComboBox1.Width := StringGrid1.ColWidths[ACol] + 3;
      ComboBox1.Visible := True;
    end;
      

  3.   

    Grid失去焦点事件怎么没有?我的焦点在其它组件,Grid中还会显示Combobox组件。
      

  4.   

    在 exit 事件中:
    ComboBox1.Visible := false;