Forum > LCL

{SOLVED] Replace an image in a TImageList

(1/2) > >>

I have someting in mind I'd like to do that would require me to replace, in a TImageList, an image at a given ImageIndex with another image at runtime. Would this be possible ?? I've searched online and couldn't find anything definitive.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type   TCustomImageList = class(TLCLComponent)  ...    procedure Replace(AIndex: Integer; AImage, AMask: TCustomBitmap; const AllResolutions: Boolean = True);    procedure ReplaceSlice(AIndex: Integer; Image: TCustomBitmap; AImageRect: TRect; const AllResolutions: Boolean = True);    procedure ReplaceSliceCentered(AIndex, AImageWidth: Integer; Image: TCustomBitmap; const AllResolutions: Boolean = True);    procedure ReplaceIcon(AIndex: Integer; AIcon: TCustomIcon);    procedure ReplaceMasked(Index: Integer; NewImage: TCustomBitmap; MaskColor: TColor; const AllResolutions: Boolean = True);  ...  end;

Thanks wp, I'll see what I can do with that  ;)

I hadn't realised that those procedures are already part of TImageList, I really should have looked into that more %). Thanks for your post that got me there wp ;)

When your source code contains the word "TImageList", hold down the Ctrl-Key and click on "TImagelist" -- this opens the unit in which TImageList is defined. TImageList has only published properties, therefore repeat the same procedure with the ancestors TDragImageList (in "TImageList = class(TDragImageList)") and TCustomImageList to get to the declaration of TCustomImageList in which all the methods and properties are listed. Scroll down a bit to see them.

Navigating the source code is the ultimate and most up-to-date help tool.


[0] Message Index

[#] Next page

Go to full version