bitbtn,speedbutton可以设置图片,但与文字在同一图层,我希望文字是叠加在图的上面。
button的brush,bitmap怎么使用?
谢谢各位。在线等待

解决方案 »

  1.   

    我知道了,在speedbutton的space中写入-10就可以了
      

  2.   

    这样不太好吧,最好是自己处理paint。
      

  3.   

    一个新BUTTON。支持位图
    TMyBtn=class(TCustomControl)
    .........
     private
     FGlyph:TBimtap;
               /////////
     procedure SetGlyph(Val:TBimtap);
    .................
     protected
     procedure Paint;override;
    ............
     published
     ........
     //公布新属性
     property Glyph:TBimtap read FGlyph write SetGlyph;constructor TMyBtn.Create(AOwner:TComponent);
    begin
     inherited Crerate(AOwner);
     FGlyph:=TBimtap.Create;
    ........
    end;
    /////析构中记得销毁FGlyph;procedure TMyBtn.SetGlyph(val:TBitmap);
    begin
     FGlyph.Assign(val);
     invalidate;
    end;
    procedure TMyBtn.Paint;
    begin
      with Canvas do
      begin
       ///////如果有图片,那么画上去
       if not FGlyph.Empt then
       Draw(0,0,FGlyph);
       //////如果有Caption 那么画上去。
      TextOut(0,0,Caption);
      end;end;
    ////////具体什么样子,,全看你想要的了当然一个完整的Button不只这些要写。。其他的需要写的东西可以看三方Button的代码。
      

  4.   

    同意:SydPink(敲坏10块键盘就能成高手)