J'ai un imagelist que je rempli dynamiquement pour après renseigner les imageindex des boutons (créer aussi dynamiquement) d'un TcategoryButtons (Composants de D2005).
Le problème c'est que la transparence va trop loin, en clair je vois a travers mon application, problème que je n'ai pas quand les images sont déjà intégrées à l'imagelist.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
var
  Categ : TButtonCategory;
  Button : TButtonItem;
begin 
  // création des boutons
  j := 0;
  for i := low(plugin) to high(plugin) do
  begin
    bfound := False;
    while (j <= CategoryButtons1.Categories.Count -1) and not bFound do
    begin
      if CategoryButtons1.Categories.Items[j].Caption = Plugin[i].Menu.Categorie.Caption then
        bFound := True
      else
        inc(j);
    end;
 
    if bFound then
      Categ := CategoryButtons1.Categories.Items[j]
    else begin
      Categ := TButtonCategory.Create(CategoryButtons1.Categories);
      CategoryButtons1.Categories.AddItem(Categ,j);
    end;
 
    With Categ do
    begin
      Color := PlugIn[i].Menu.Categorie.Color;
      GradientColor := PlugIn[i].Menu.Categorie.GradientColor;
      TextColor := PlugIn[i].Menu.Categorie.TextColor;
      Caption := PlugIn[i].Menu.Categorie.Caption;
    end;
 
    if Plugin[i].Menu.Bitmap <> nil then
      With imagelist1 do
      begin
        Masked := false;
        TransparentColor := True;
        TransparentColorValue := clFuchsia;
        BkColor := Categ.Color;
        Plugin[i].Menu.Bitmap.TransparentColor := clFuchsia;
        Plugin[i].Menu.Bitmap.Transparent := True;
        Add(Plugin[i].Menu.Bitmap,nil);
        Plugin[i].Menu.ImageIndex := Count -1;
      end;
 
    Button := TButtonItem.Create(Categ.Items);
    Button.Caption := Plugin[i].Menu.Button.caption;
    Button.Hint := IntToStr(i);
    Button.ImageIndex := Plugin[i].Menu.ImageIndex;
    Categ.Items.AddItem(Button,0);
voici ce que ca donne :