cadenza
asked on
several TImages, 1 hPalette -> problem
I use several TImages to display data. They all need the same colours, so I made 1 logical palette and 1 hPalette, which I assigned to the Picture.Bitmap.Palette property of all TImages. I use CopyRect to copy part of a memory bitmap to the TImages. This goes OK, unless I mirror the data in the CopyRect. (by passing for the source rect: Bounds(width-1, 0, -width, height-1)). Then the TImage stays black. If I give every TImage its own hPalette, the mirroring goes fine.
My questions:
1- is what I try at all posiible, or do all TImages always need a unique hPalette?
2- if it is possible, what should I change to make it work?
thanks,
Wim
My questions:
1- is what I try at all posiible, or do all TImages always need a unique hPalette?
2- if it is possible, what should I change to make it work?
thanks,
Wim
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is fine however better way is to remember the hPalette in your program and use SelectPalette( savedpalette .....
at the end of pgm you must delete this object.
BTW SelectPalette returns previous palette so you must save this and then restore. You can loose resources if this will not be done !.
prevpal := SelectPalette( ...
...
any code
...
SlelectPalette( prevpal
this is good idea to save resources without loose.
sorry for my english.
at the end of pgm you must delete this object.
BTW SelectPalette returns previous palette so you must save this and then restore. You can loose resources if this will not be done !.
prevpal := SelectPalette( ...
...
any code
...
SlelectPalette( prevpal
this is good idea to save resources without loose.
sorry for my english.
ASKER
Thanks for the answer and valuable comment. This not only will save me time, but, as I understand from Mirek's comment, resources as well !!!
Wim
Wim
ASKER