1

从 AdvancedTabs 单元中的示例代码开始,我一直在 Lazarus 中尝试了几个小时,以使 am 图像出现在按钮上。

示例代码有这样的:

constructor TAdvancedTabs.Create; 
var 
  I : integer; 
begin 
  inherited; 
  with SelfSession do begin 
    SetCodePress; 
    SetStyle('.new-tab{background-image:url(' + ExtPath + '/examples/feed-viewer/images/new_tab.gif) !important}'); 
    SetStyle('.tabs{background:url(' + ExtPath + '/examples/desktop/images/tabs.gif)}'); 
  end; 
  with TExtButton.Create do begin 
    RenderTo := 'body'; 
    Text     := 'Add Tab using AJAX!'; 
    IconCls  := 'new-tab'; 
    Handler  := Ajax(AddTab); 
    OnClick  := HandleExtButtonClick; // Delphi style event handler 
  end; 
... 

我有这个:

 extPath := (CurrentFCGIThread as TExtThread).ExtPath; 
  (CurrentFCGIThread as TExtThread).SetStyle('.backbtn{background-image:url(' + ExtPath + '/basxv2/back.png) !important}'); 
  btnClose := TV2ExtButton.Create; 
  with btnClose.AddTo(Items) do 
    begin 
    Id := 'frmManualOrder_btnClose'; 
    X := MarginLeft; 
    Height := ButtonHeight; 
    Y := ScreenHeight-12*MarginLeft; 
    Width := ButtonWidth-10; 
    RenderTo := 'body'; 
    IconCls := 'backbtn'; 
... 

我尝试了许多不同的方法,例如将图像转换为 gif,并且在大多数情况下,按钮要么是空白的(如果我没有设置 Text 属性),要么将文本向右轻推几个像素仿佛为无形的图像腾出空间。图像出现几次,顶部和底部被剪裁。

谁能看到我做错了什么?

TIA 标志

4

0 回答 0