Changing the colour of individual fields in report in AX:

Hi,
To Change the color of individual records in report in AX..
Write this code in the execution section method for any section where you have to get the different colors for alternate records..

public void executeSection()
{
int controlcount;
int counter;
int usecolor;
int oldcolor;
object reportobject;
;

controlcount=this.controlCount();
oldcolor=this.foregroundColor();

if(oldcolor==WinApi::RGB2int(255,255,255))
usecolor=WinApi::RGB2int(209,209,209);
else
usecolor=WinApi::RGB2int(255,255,255);

this.foregroundColor(usecolor);

for(counter=1;counter<=controlcount;counter++)
{
reportobject=this.controlNo(counter);
reportobject.backgroundColor(usecolor);
}
super();
}

Output:
rep

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s