lundi 5 mars 2012

Change axapta form color based on the company


how to make a form color change in Dynamics AX based on the company that was logged in.


To do this, we need to create/override run() method in SysSetupFormRun class. 


Please refer to the code sample below. 
It shows how to change the color to red or yellow based on the company DAS or DMO.

public void run()
{
    int red;
    int yellow;
    ;


    super();


    red = WinAPI::rgb2int(255,0,0);
    yellow = WinAPI::rgb2int(204,255,0);


    this.design().colorScheme(FormColorScheme::RGB);


    switch(curext())
    {
        case "DAS":
            this.design().backgroundColor(red);
            break;


        case "DMO":
            this.design().backgroundColor(yellow);
            break;


        default:
            break;
    }
}

Aucun commentaire:

Enregistrer un commentaire