Einzelnen Beitrag anzeigen

mihey

Registriert seit: 6. Jan 2005
4 Beiträge
 
#3

Re: Ich kann nicht gelesen icon zeichnen.

  Alt 7. Jan 2005, 13:20
Thank you, I really used an online translator.

I'm trying to write a class that would read and save icons because Delphi's TIcon doesn't work with 32-bit icons and in all doesn't suit me.

I create a HBITMAP using CreateDIBSection so I have a pointer to bitmap data and then I read the bits from the file into the bitmap. To create TBitmap, I assign HBITMAP to TBitmap.Handle. The code works fine with 32-bit icons that have no palette. But then I created an icon with Borland's Image Editor. The icon is 4-bit and has a palette (should have at least). And here come all the problems. When I assign a palette to TBitmap and run the program under Delphi, the system crashes. When I run the program simply under Windows, the bitmap is displayed black or in incorrect colors (depending on iUsage parameters of CreateDIBSection) and even the mask doesn't work correctly also it seem to be read properly (the image of mask is displayed properly).

The thing is I've been trying to solve this problem for a long time and still can't.

The source code is here (20 Kb). I use Delphi 5.

http://www.hot.ee/mvps18/IconLoad.zip

Try to load Test2.ico and see how the icon is displayed.

Could you help me to solve the problem???
  Mit Zitat antworten Zitat