25.07.2008, 03:08 | #1 |
Участник
|
casperkamal: Adding custom images for Treenode in Dynamics Ax
Источник: http://casperkamal.spaces.live.com/B...CD63!446.entry
============== Tree node and Icons for tree nodes are inseparable. Right icons can make your tree look lot different.. Here is one tweak for getting the difference. This article deals with displaying external images as tree node icons. Images used in Treenode should be passed as Imagelist. Ax has set a predefined set of classes starting with ImageListAppl that helps to manage different sorts of ImageLists. ImageListAppl is the base classes of all such classes. The most appropriate way to enable a strong support for external images in tree node would be through modifying the ImageListAppl class to load external images. (Currently they can load only resource numbers). The following code below when added to the base class helps you load images externally or through resource nodes. X++: public void addImage(int _idNo, FilePath _filePath) { int imageNum; Image image = new Image(); try { if (_filePath) { image.loadImage(_filePath); imageNum = imagelist.add(image); imageConvert.insert(_idNo, imageNum); } } catch { warning(strfmt("@SYS85977")); } } this.I4C_addImage(#ImageNewPic, SysResource::getImagePath('myimage')); Every Image loaded has to be identified through some resource numbers. Generally it is better if the new resource number you assign is greater than the system defined resource number.To identify the Highest resource number always refer to the “SysImageResources” form. (4.0 users you can use the Tutorial_resources form). Two things to note from the above line of code. -> The new Resource numbers has to be defined as a macro in a new macro node or to an existing macro node like resappl (it contains the standard resource number). -> In the above example i have used an image from the resource node, you can also use an external image which is stored in the computer. (Resource node is preferred, coz it is easy to distribute) To use this image all you need to do is just load the same Image list class with your tree control and then just refer to the new resource number for the image that you wanted to display. X++: salesLineTree.setImagelist(imageList.imageList()); SysFormTreeControl::addTreeItem(salesLineTree, displaystring, 0, 0, #myImage); Keep reading… :) Источник: http://casperkamal.spaces.live.com/B...CD63!446.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|