Wednesday 18 March 2015

Adding a image in a form

we can add a image in a form, what will happen is that it will open a form and it will display the image  in the form .

step1:go to the AOT right click on resource and select  create from file



select and image from the list



the save the file atlast in the resource section you will get something like

then create a form  and in a form design add a  control as window and set the auto declaration property as "Yes";



Then we have to write a method on the form

public void method1()
{
    container       imagedata;
    resourceNode   resourceNode;
    Image           Image;

    ResourceName    ResourceName =  resourceStr(Chrysanthemum_jpg);
    resourceNode  = SysResource::getResourceNode(ResourceName);
    if(resourceNode)
    {
        //load the image
        resourceNode.AOTload();
        imagedata = SysResource::getResourceNodeData(resourceNode);
        Image  = new Image();
        Image.setData(imagedata);

        //setting the image to window control
        //Window.
        CustomImage.image(Image);



    }

}

Once this method is written we need to call this  in the run method of the form.

public void run()
{
    super();
    element.method1();
}

When we wrote these method now our form is all set to go.

now right click on the form and open the form you will get a form something like this.



So this is one of the way to display image in a form in ax 2012 .





No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...