Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2013.03.22;
Скачать: 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 вся ветка

Текущий архив: 2013.03.22;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.099 c
2-1329850454
Аццкий
2012-02-21 22:54
2013.03.22
вопрос про чар


15-1329975955
Ega23
2012-02-23 09:45
2013.03.22
С праздником, мужики!


2-1330269660
Незнающий усталости
2012-02-26 19:21
2013.03.22
Как задать фокус ячейки?


2-1333344537
SvK.droNe
2012-04-02 09:28
2013.03.22
Рациональная интерполяция с помощью непрерывных дробей.


15-1337884316
Bluejohn
2012-05-24 22:31
2013.03.22
Правильно ли сделан список?