Delphi本身提供对Color,font,的调度,所以你可以直接设置IFONT接口的FONT属性具体的可以看一下书

解决方案 »

  1.   

    to qqcxg(爱谁谁):
    我试过 IFont*,但不知道还要什么代码,买不起书看...
      

  2.   

    使用IFont吧好用的!很方便的
      

  3.   

    哎!你自己写IFont 的的数据呵呵一点都不难!
      

  4.   

    var
      fnt:tfont;
    begin
      fnt:=iinterface1.Font;
      form1.Font:=fnt;
    end;
      

  5.   

    我很奇怪这个问题,很难吗?
    在你的myimage中定义的myfont属性,设其类型为ifont不就可以了???
      

  6.   

    unit Unit2;interfaceuses
      ComObj, ActiveX,windows, Project1_TLB,Graphics, StdVcl;type
     TFontX=Class(TFont,IFont)
      protected
        function get_Name(out name: WideString): HResult; stdcall;
        function put_Name(name: WideString): HResult; stdcall;
        function get_Size(out size: Currency): HResult; stdcall;
        function put_Size(size: Currency): HResult; stdcall;
        function get_Bold(out bold: BOOL): HResult; stdcall;
        function put_Bold(bold: BOOL): HResult; stdcall;
        function get_Italic(out italic: BOOL): HResult; stdcall;
        function put_Italic(italic: BOOL): HResult; stdcall;
        function get_Underline(out underline: BOOL): HResult; stdcall;
        function put_Underline(underline: BOOL): HResult; stdcall;
        function get_Strikethrough(out strikethrough: BOOL): HResult; stdcall;
        function put_Strikethrough(strikethrough: BOOL): HResult; stdcall;
        function get_Weight(out weight: Smallint): HResult; stdcall;
        function put_Weight(weight: Smallint): HResult; stdcall;
        function get_Charset(out charset: Smallint): HResult; stdcall;
        function put_Charset(charset: Smallint): HResult; stdcall;
        function get_hFont(out font: HFont): HResult; stdcall;
        function Clone(out font: IFont): HResult; stdcall;
        function IsEqual(const fontOther: IFont): HResult; stdcall;
        function SetRatio(cyLogical, cyHimetric: Longint): HResult; stdcall;
        function QueryTextMetrics(out tm: TTextMetricOle): HResult; stdcall;
        function AddRefHfont(font: HFont): HResult; stdcall;
        function ReleaseHfont(font: HFont): HResult; stdcall;
         function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
        function _AddRef: Integer; stdcall;
        function _Release: Integer; stdcall;
      end;
      TTestFont = class(TAutoObject, ITestFont)
      protected
        procedure Font(const Value: IFont); safecall;
        { Protected declarations }
      end;implementationuses ComServ,Unit1;procedure TTestFont.Font(const Value: IFont);
    var
     XFont:TFontX;
     p:pointer;
    begin
     XFont:=p;
     p:=XFont;
     Form1.Font:=p;
     
    end;
    function TFontX.get_Name(out name: WideString): HResult; stdcall;
    begin
    name:=Self.Name;
    end;
    function TFontX.put_Name(name: WideString): HResult; stdcall;
    begin
    self.Name:=Name;end;
    Function TFontX.get_Size(out size: Currency): HResult; stdcall;
    begin
     self.Size:=size;
    end;
    function TFontX.put_Size( size: Currency): HResult; stdcall;
    begin
    self.Size:=size;
    end;initialization
      TAutoObjectFactory.Create(ComServer, TTestFont, Class_TestFont,
        ciMultiInstance, tmApartment);
    end.
    你吧TFontX的方法全实现了就可以这样用了,没时间来搞现在转告软件工程了!
      

  7.   

    非常感谢各位的支持,尤其是 manboo(横刀) 大侠。转了个小弯总算实现了要的结果,美中不足的是,属性的属性还不能被 InterDev 这样的智能IDE自动列出,只能是:set obj2 = obj1.property1
      obj2.property2 = x看来还得多看些书