ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnMView: Load images from a DLL?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Sep 10 2024 : 02:35:47
Does TImageEnMView have a built-in method to load the images from an Icon DLL, e.g.:

C:\Windows\System32\imageres.dll

// Does not work:
  ImageEnMView1.MIO.LoadFromFileAuto('C:\Windows\System32\imageres.dll');
  ImageEnMView1.Update;


This would be very useful!
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 13 2024 : 00:14:18
Nice one, Peter. Did you try assigning the TImageList to TImageEnMView?

ImageEnMView1.Assign( ImageList1 );

https://www.imageen.com/help/TImageEnMView.Assign.html

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Sep 10 2024 : 06:22:29
Now, here is the complete finished working ICON DLL VIEWER project:



attach/PeterPanino/20249106221_TImageEnMViewLoadFromDLL.zip
78.1 KB
PeterPanino Posted - Sep 10 2024 : 05:24:40
I've finally found the solution to make the images in the ImageEnMView transparent:

procedure AddImageListToImageEnMView(ImageList: TImageList; ImageEnMView: TImageEnMView);
var
  i: Integer;
  Icon: TIcon;
  IEBitmap: TIEBitmap;
begin
  // Clear the TImageEnMView before adding new images
  ImageEnMView.Clear;

  for i := 0 to ImageList.Count - 1 do
  begin
    // Create a new TIcon and retrieve the icon from the ImageList
    Icon := TIcon.Create;
    try
      ImageList.GetIcon(i, Icon);

      // Create a new TIEBitmap to hold the icon image
      IEBitmap := TIEBitmap.Create;
      try
        // Assign the icon directly to the TIEBitmap
        IEBitmap.Assign(Icon);

        // Append the TIEBitmap to the TImageEnMView
        ImageEnMView.AppendImage(IEBitmap);
      finally
        IEBitmap.Free;
      end;
    finally
      Icon.Free;
    end;
  end;

  // Adjust thumbnail settings for better visibility
  ImageEnMView.ThumbWidth := ImageList.Width + 5;
  ImageEnMView.ThumbHeight := ImageList.Height + 5;
  ImageEnMView.HorizBorder := 5;
  ImageEnMView.VertBorder := 5;
end;
PeterPanino Posted - Sep 10 2024 : 04:48:11
Even when using the ImageIDRequest trick shown in the documentation, the images are still not transparent:

procedure AddImageListToImageEnMView(ImageList: TImageList; ImageEnMView: TImageEnMView);
var
  i: Integer;
begin
  ImageEnMView.Clear;

  // Add an ID for every bitmap in a TImageList
  for i := 0 to ImageList.Count - 1 do
  begin
    ImageEnMView.InsertImage(I);
    ImageEnMView.ImageID[I] := I;
  end;
end;

procedure TForm1.ImageEnMView1ImageIDRequest(Sender: TObject; Index, ID: Integer; var Bitmap: TBitmap);
begin
  // Retrieve the image from a TImageList
  Bitmap := TBitmap.create;
  ImageList1.GetBitmap(ID, Bitmap);
end;
PeterPanino Posted - Sep 10 2024 : 04:18:11
I've created a solution that loads the DLL images in TImageEnMView:



Unfortunately, the images are not transparent!

I've attached the project:

attach/PeterPanino/202491041717_TImageEnMViewLoadFromDLL.zip
78 KB

Do you know how to improve this?