![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
как впихнуть в ImageList иконку нестандартного размера [D7, XP]
webpauk © (2012-06-18 12:42:00)На форме есть ImageList (Width = 48, Height = 48)
Пытаюсь:
MyIcon:=TIcon.Create;
MyIcon.Width:=48;
MyIcon.Height:=48;
ImageList.AddIcon(MyIcon);
происходит ошибка, т.к. при добавлении иконки в AddIcon проверяется её размеры:
function TCustomImageList.AddIcon(Image: TIcon): Integer;
begin
if Image = nil then
Result := Add(nil, nil)
else
begin
CheckImage(Image);
Result := ImageList_AddIcon(Handle, Image.Handle);
end;
Change;
end;
procedure TCustomImageList.CheckImage(Image: TGraphic);
begin
if Image <> nil then
with Image do
if (Height < FHeight) or (Width < FWidth) then
raise EInvalidOperation.Create(SInvalidImageSize);
end;
Как обойти ограничение? Ведь вручную иконка впихивается!!!
webpauk (2012-06-18 13:11:00) [1]Нашел:
function ImageList_ReplaceIcon(ImageList: THandle; Index: Integer; Icon: hIcon): Integer; stdcall; external 'comctl32.dll' name 'ImageList_ReplaceIcon';
procedure MyAddIconPrc;
begin
ImageList_ReplaceIcon(ImageList.Handle, -1, MyIcon.Handle);
end;
brother (2012-06-18 12:52:00) [2]перекрыть CheckImage?