Autor Beitrag
MrKnogge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP, Win 7
Delphi 7 Prof, Delphi 2005 PE, C# (VS 2008)
BeitragVerfasst: Fr 24.01.03 19:30 
Hi

da man in den Delph-Menüs leider nur BitMaps benutzen kann, wollt ich einen kleinen konverter schreiben der Icon´s in BitMaps kovertiert und umgekehrt.

Das von Icon nach BitMap klappt bereits.

Nur andersrum habe ich das Problem, das das Icon invertiert ist, also immer so als ob es markiert wäre, wenn ich es markiere ist es so wie ichs will.

ausblenden volle Höhe Quelltext
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:
begin 
pathload := LWL+DNL+'.bmp'; 
pathsave := LWS+DNS+'.ico'; 
IconX := GetSystemMetrics(SM_CXICON); 
IconY := GetSystemMetrics(SM_CYICON); 
Icon := TIcon.Create; 
Bitmap := TBitmap.Create; 
Mask := TBitmap.Create; 
BitMap.Width:=IconX; 
BitMap.Height:=IconY; 
Mask.Width:=IconX; 
Mask.Height:=IconY; 
Mask.Monochrome:=true; 
Bitmap.LoadFromFile(pathload); 
Mask.LoadFromFile(pathload); 

with iconinfo do begin 
  fIcon:=true; 
  xHotspot:=0; 
  yHotspot:=0; 
  hbmMask:=Mask.Handle; 
  hbmColor:=BitMap.Handle; 
  end; 

Icon.Handle:=CreateIconIndirect(IconInfo); 
Icon.SaveToFile(pathsave); 
Icon.Free; 
Bitmap.Free; 
Mask.Free; 

end;

_________________
MfG MrKnogge
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: Fr 24.01.03 19:38 
Probier mal, "Mask.Monochrome" nach "Mask.LoadFromFile()" zu setzen, dann ist Mask auf jeden Fall Monochrom.