Вниз
Скачать: CL | DM;

как впихнуть в ImageList иконку нестандартного размера   Найти похожие ветки 

← →
webpauk ©   (2012-06-18 12:42) [0]

На форме есть 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;


Как обойти ограничение? Ведь вручную иконка впихивается!!!


← →
brother ©   (2012-06-18 12:52) [1]

перекрыть CheckImage?


← →
webpauk ©   (2012-06-18 13:11) [2]

Нашел:

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;



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.045 c
2-1348395531
Писатель
2012-09-23 14:18
2013.03.22
Преобразование String в PwideChar


15-1351699705
ПростоФАН
2012-10-31 20:08
2013.03.22
Помощь в разработке по


15-1349184464
Roman_man
2012-10-02 17:27
2013.03.22
Реакция на мышь в не формы


15-1344643133
wl
2012-08-11 03:58
2013.03.22
творение? потом...


15-1329815103
Kolan
2012-02-21 13:05
2013.03.22
Напомните историю про уволенного программиста




   Наверх