ImageList 中使用XP ICON的问题(Delphi&BCB)(100分)

H

hzy104

Unregistered / Unconfirmed
GUEST, unregistred user!
由于VCL本身设计的问题,使得VCL控件使用XP ICON的时候会有模糊的边,
在官方网站上http://qc.borland.com/wc/qcmain.aspx?d=4653,有种解决方案:
其中:
procedure ConvertTo32BitImageList(const ImageList: TImageList);
const
Mask: array[Boolean] of Longint = (0, ILC_MASK);
var
TempList: TImageList;
begin
if Assigned(ImageList) then
begin
  TempList := TImageList.Create(nil);
  try
  TempList.Assign(ImageList);
  with ImageList do
  begin
  Handle := ImageList_Create(
    Width, Height, ILC_COLOR32 or Mask[Masked], 0, AllocBy);

  if not HandleAllocated then
    raise EInvalidOperation.Create(SInvalidImageList);
  end;

  Imagelist.AddImages(TempList);
  finally
  FreeAndNil(TempList);
  end;
end;
end;
我用BCB将其改写,发现根本就不行:
void TForm1::ConvertTo32BitImageList(TImageList* ImageList)
{
  const long int Mask[2] = {0,ILC_MASK};
  TImageList* TempList;
  if(ImageList != NULL){
  TempList = new TImageList(NULL);
  __try{
    TempList->Assign((TPersistent*)(ImageList));
    ImageList->Handle = (unsigned int)ImageList_Create(TempList->Width,TempList->Height,
    ILC_COLOR32|Mask[1],0,TempList->AllocBy);
    if(!ImageList->HandleAllocated())
        throw Exception("ValidOperationOnImageList");
    ImageList->AddImages(TempList);
  }
  __finally{
    delete TempList;
    TempList = NULL;
  }
   }
}
各位有没有好的建议???
 
顶部