Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   Iconos XP en runtime (https://www.clubdelphi.com/foros/showthread.php?t=23262)

arj2000 12-07-2005 13:15:22

Iconos XP en runtime
 
Muy buenas.

Estoy intentando cargar iconos xp (alpha blending) en un TImageList en tiempo de ejecución y se me ven muy mal. Lo que hago es leer la ruta del icono desde la base de datos y insertar el icono en el TImageList mediante un TIcon.

¿Que hago mal? ¿O es que no se puede? Lo digo porque si meto directamente los iconos en el TImageList desde el editor del Delphi se ven muy bien.

Muchas gracias de antemano.

yusnerqui 12-07-2005 14:55:55

Hola
 
No te aseguro que funcione, pues no lo puedo probar ahora, pero quizás con:

Código Delphi [-]
  ImageList1.Masked := true;

mejore la apariencia.


Saludos.

arj2000 12-07-2005 16:09:16

Pues no funciona. Ni poniendo ImageType a itMasked, ni Masked a true... Ya te digo, si cargo los archivos uno a uno
(porque si le haces que carge más de 2 a la vez, se cargan mal también) en el imagelist antes de compilar, va bien, pero si lo hago en el "create" o en el "show" o donde sea, se ven sin el "alpha channel".

Es una putada, porque no hay manera de cargar "dinamicamente" iconos en formato XP :(

arj2000 07-02-2006 23:12:16

Lo conseguí
 
Código:

procedure TfrmReNamer.ConvertTo32BitImageList(const ImageList: TImageList);
const
  Mask: array[Boolean] of Longint = (0, ILC_MASK);
var
  TemporyImageList: TImageList;
begin
  // add to uses: commctrl, consts; 
  if Assigned(ImageList) then
  begin
    TemporyImageList := TImageList.Create(nil);
    try
      TemporyImageList.Assign(ImageList);
      with ImageList do
      begin
        ImageList.Handle := ImageList_Create(Width, Height, ILC_COLOR32 or Mask[Masked], 0, AllocBy);
        if not ImageList.HandleAllocated then
        begin
          raise EInvalidOperation.Create(SInvalidImageList);
        end;
      end;
      ImageList.AddImages(TemporyImageList);
    finally
      TemporyImageList.Free;
    end;
  end;
end;



La franja horaria es GMT +2. Ahora son las 18:46:08.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi