Autor Beitrag
mihey
Hält's aus hier
Beiträge: 1

Win 98
D5 Ent
BeitragVerfasst: So 09.01.05 16:55 
Ich habe ein DC von der Form und abgesondert geschaffen HPALETTE. Ich schaffe TBitmap und DIBSection auf folgende Weise:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var 
  BitmapInfo: TBitmapInfo;
  BitmapBits: Pointer;
  CanvasHandle: HDC;
...
CanvasHandle := MyForm.Handle;
...
ABitmap := TBitmap.Create;
ABitmap.Handle := CreateDIBSection(
  CanvasHandle, BitmapInfo, DIB_RGB_COLORS, BitmapBits, 0, 0);
...


Weiter lese ich die bitmap bits in das Pointer (BitmapBits). Wenn ich ABitmap zeichne, werden seiner Farbe verzerrt. Warum?

Wenn ich mich die Palette anmasse, hängenbleibt ganzes System.

ausblenden Quelltext
1:
2:
If (HIconPalette <> 0) and (BitMapInfoHeader.biBitCount <= 8) 
 then ABitmap.Palette := HIconPalette;


Warum?