Changing Form color based on the current Company
By default, all the forms look the same. This can be confusing for those super users that switch between companies preforming different task.
Well I came across a neat little trick that I am going to post here. I am not sure how well this will work in Dynamics AX 4.0, but for AX 3.0 it works great.
Basically you override the SysSetupFormRun.run() method. Below is some sample code:
public void run()
{
;
super();
// Set the color scheme of this instance of te SysFormRUn to RGB
this.design().colorScheme(FormColorScheme::RGB);
// Switch and based on the current company change colors, or not for default
switch (curext())
{
case ‘DEM’:
this.design().backgroundColor(WinAPI::navisionColorRed());
break;
case ‘dat’:
this.design().backgroundColor(WinAPI::navisionColorBeige());
break;
default:
break;
}
}
Now when you switch between the two companies and launch a form, you will see visually, that you are in a different company. Granted the WinAPI::navisionColorBeige(), ..Blue(), ..Red() are not that great looking, but still you get the idea. And if you know RGB colors, then you can supply really any valid RGB color you like!
Anyway this is a neat little trick that is ran each time a new instance of a given form (other that the main menu) is ran.