这是我加载ico的代码:
  icon := TIcon.Create;
  try
    icon.LoadFromFile('c:/1.ico');
    ImageListToolBar.AddIcon(icon);
  finally
    FreeAndNil(ico);
  end;

解决方案 »

  1.   

    icon := TIcon.Create;
      try
        icon.LoadFromFile('c:/1.ico');
        ImageListToolBar.AddIcon(icon);
        ImageListToolBar.Refresh;//加上这句44
      finally
        FreeAndNil(ico);
      end;
      

  2.   

    大哥,ImageList根本没有Refresh这个方法。
      

  3.   

    我以为你指的是ToolBar,刷新一下ToolBar。
    ToolBar1.Refresh
      

  4.   

    把你所要的多个Icon先在设计时载入ImageList,顺序自己排列好,然后导出成Bmp。
    在程序里再动态加载这个Bmp文件。procedure AddImageList(gImage: TImageList; sFileName: String);
    var
      bmp: Graphics.TBitmap;
      sAppDir: String;
    begin
      sAppDir:=ExtractFileDir(Application.ExeName)+'\';
      bmp := Graphics.TBitmap.Create;
      try
        if (FileExists(sAppDir+sFileName)) then
        begin
          bmp.LoadFromFile(sAppDir+sFileName);
          bmp.TransparentMode := tmAuto;
          bmp.Transparent := True;
          gImage.Clear;
          gImage.Height:=bmp.Height;
          gImage.Width:=bmp.Height;
          gImage.AddMasked(Bmp,Bmp.TransparentColor);
        end;
      finally
        bmp.Free;
      end;
    end;