procedure TForm2.GetProperty(dispobj: IDispatch; PropertyName: WideString; var retvalue: Variant; Sender: TObject); var hr: HRESULT; DispId: integer; value: Variant; params: TDispParams; begin hr:=dispobj.GetIDsOfNames(GUID_NULL,@PropertyName, 1, LOCALE_SYSTEM_DEFAULT, @DispId); Label1.Caption:=inttostr(DispId); hr:=dispobj.Invoke(DispId,GUID_NULL,LOCALE_SYSTEM_DEFAULT,DISPATCH_PROPERTYGET, Params,@Value,nil,nil); Retvalue:=Value; Label2.Caption:=inttostr(value); end; procedure TForm2.SetProperty(dispobj: IDispatch; PropertyName: WideString; Value: OLEVariant; Sender: TObject); var hr: HRESULT; DispId: integer; params: TDispParams; begin hr:=dispobj.GetIDsOfNames(GUID_NULL,@PropertyName,1, LOCALE_SYSTEM_DEFAULT, @DispId); Label1.Caption:=inttostr(DispId); params.rgvarg:=@Value; params.rgdispidNamedArgs:=@DispIDArgs; params.cArgs:=1; params.cNamedArgs:=1; hr:=dispobj.Invoke(DispId,GUID_NULL,LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT,Params,nil,nil,nil); end;
They work fine with Color and Style properties of IGraphAxes:
GetProperty(Graph1.GraphAxes, 'Color', retvalue, Sender);
Or
SetProperty(Graph1.GraphAxes, 'Color',value,Sender);
联系客服