有一个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;
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;
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;