Axapta provides a very handy feature to allow developers to ship their solution with Axapta built-in image files. In Application Object Tree, you can find resources node. Select resources node and right click; select Create from file, specify the file location for the new resource file. After that you can use this resource file in Axapta without specifying an absolute file path in your hard disk.
Then let’s see how to use this kind of files in Axapta.
First, pick up the resource node from AOT;
SysResource::getResourceNode();
Then let’s see how to use this kind of files in Axapta.
First, pick up the resource node from AOT;
SysResource::getResourceNode();
Then generate a temporary file for this resource file;
SysResource::saveToTempFile()
SysResource::saveToTempFile()
Finally specify the temporary file path for controls.
Here comes an example to show how to use a resource file as a background image of a given form.
{ ResourceNode resourceNode;
FilePath imagename;
;
resourceNode = SysResource::getResourceNode(resourcestr(yourResourceName));
if (resourceNode)
{
resourceNode. AOTload();
imagename = SysResource::saveToTempFile(resourceNode);
}
else
{
throw Error(“No file …exists.”)
}
FilePath imagename;
;
resourceNode = SysResource::getResourceNode(resourcestr(yourResourceName));
if (resourceNode)
{
resourceNode. AOTload();
imagename = SysResource::saveToTempFile(resourceNode);
}
else
{
throw Error(“No file …exists.”)
}
element.design().imageName(imagename);
}
No comments:
Post a Comment