有一个ActiveX控件叫MsFlexGrid.我在VB中使用并无问题,但在Delphi中使用时,当我对TextMatrix这个属性进行赋值时出现错误信息'无效的参数数目.',但读取时却无错误。代码如下:
    Form1.Caption:=MsFlexGrid1.TextMatrix[3,2]; //执行此句并无出错
    MsFlexGrid1.TextMatrix[3,2]:='a'; //执行此句出错
    以下是Delphi创建的关于此控件的单元文件中此属性的定义:
property TextMatrix[Row: Integer; Col: Integer]: WideString read Get_TextMatrix write Set_TextMatrix;procedure TMSFlexGrid.Set_TextMatrix(Row: Integer; Col: Integer; const TextMatrix: WideString);
  { Warning: The property TextMatrix has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.TextMatrix := TextMatrix;
end;

解决方案 »

  1.   

    这不难MsFlexGrid1.DefaultInterface.TextMatrix[3,2]:='hello'; 就ok了!别忘了给分!!!
      

  2.   

    我想请教:为什么我通过delphi中的Component-->Import ACTIVEX Control导入ActiveX控件,在delphi中为什么看不到,我通过CreateOleObject创建接口也可以调用,但那样有时候就创建不了。我怀疑我的创建和释放有问题,如果我能加载到VCL中就可以让DELPHI自动管理了
      

  3.   

    1.
      MsFlexGrid1.DefaultInterface.TextMatrix[3,2]:='hello'2  更改文件定义 Delphi 的 bugproperty TextMatrix[Row: Integer; Col: Integer]: WideString read Get_TextMatrix write Set_TextMatrix;procedure TMSFlexGrid.Set_TextMatrix(Row: Integer; Col: Integer; const TextMatrix: WideString);
      { Warning: The property TextMatrix has a setter and a getter whose
      types do not match. Delphi was unable to generate a property of
      this sort and so is using a Variant to set the property instead. }
    var
      InterfaceVariant: OleVariant;
    begin
      InterfaceVariant := DefaultInterface;
     ///// InterfaceVariant.TextMatrix := TextMatrix;   ////错误
      InterfaceVariant.TextMatrix[Row,Col]:= TextMatrix;
    end;
      

  4.   

    Sorry!太久没来论坛了,都忘了结帖了.