继承TImagine类,增加一个可以显示Caption功能,望各位高手指点,谢谢
谁有相关的好资料推荐,一样谢谢,呵呵

解决方案 »

  1.   

    是timage吗?参考TLabeledEdit的源码
      

  2.   

    你想把这个Caption放在那里??把Caption放在画面上?? 直接从TImage类中继承过来,再加入Caption属性,用Canvas自己画用Label放在画面旁边?? 两个控制怎么组合,好多Delphi书上有.... 看《Delphi5开发人员指南》
      

  3.   

    TLabeledEdit的源码哪里有?谢谢呵呵,小弟新手
      

  4.   

    TMyImage=class(TImage);
    private
      FLabel:TLabel;
      FCaption:String;
      procedure SetCaption(Val:string);
    .......
    pulished
      property Caption:string read FCaption write SetCaption;
    .........construcor TMyImage.Create(AOwner:TComponent);
    begin
      inherited Create(AOWner);
      FLabel:=TLabel.Create(Self);
      .........
    end;
    destructor TMyImage.Destroy;
    begin
      FLabel.Free;
      inherited Destroy;
    end;
    ........
    procedure TMyImage.SetCaption(Val:String);
    begin
     FLabel.Caption:=val;
    end;
    ........
      

  5.   

    怎么样让Caption显示在Image的下方??谢谢
      

  6.   

    我也是看那本書,我想,在CREATE寫上代碼應該可以的
      

  7.   

    补充一下上面的:private
      procedure WMSize(var Msg : TWMSize); message WM_SIZE;......procedure TMyImage.WMSize(var Msg : TWMSize);
    begin
      FLabel.Left := Left;
      FLabel.Top := Top + Height;
    end;
      

  8.   

    TLabeledEdit的源码哪里可以找到?我找不到谢谢
      

  9.   

    一定可以显示的。把你的代码贴出来大家看看?
    另外在SydPink(Miss Syd.Barrett)的代码中漏了一句很重要的:construcor TMyImage.Create(AOwner:TComponent);
    begin
      inherited Create(AOWner);
      FLabel:=TLabel.Create(Self);
      FLabel.Parent := Self;//就是这一句
      .........
    end;