Question

Setting background colour of a dashboard pane

  • 24 January 2023
  • 6 replies
  • 379 views

Userlevel 1

I want to set the background colour of one pane in a multi-pane dashboard to white, so that it can be printed without the default grey background. There seems to be no way to do this using the dashboard properties, so I am looking at doing it in a customisation of the dashboard using c# code, but no luck so far. Has anyone succeeded in changing the background colour of a dashboard grid, and if so, how?

ERP 10.2.700

Kind regards,

Peter


6 replies

This may give you a head start. 

EpiUltraGrid ug;

//Inside Initialize Custom Code
ug = (EpiUltraGrid)csm.GetNativeControlReference("f45f4532-176c-4a87-8459-4cf95e66fd38");
ug.SummaryValueChanged += new Infragistics.Win.UltraWinGrid.SummaryValueChangedEventHandler(this.ug_SummaryValueChanged);
//

//Inside DestroyCustomCode
ug.SummaryValueChanged -= new Infragistics.Win.UltraWinGrid.SummaryValueChangedEventHandler(this.ug_SummaryValueChanged);
//


private void ug_SummaryValueChanged(object sender, Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs args)
{
// ** Place Event Handling Code Here **

ug.Appearance.BackColor = System.Drawing.Color.Blue;
}

Thanks

Aaron

Userlevel 1

Peter -

In the customization mode of the dashboard you can also turn off AppStyling.  Select the panel you wish to change on the UI and one of the top options on the properties pane is AppStyling (set this to false.)  Then set the background color to the one that you prefer on the same properties pane.

You will need to deploy this as a Dashboard Assembly to the menu for the customization to load onto the client.

HTH,

Calvin Dekker

CodaBears

Userlevel 1

Thanks Aaron & Calvin, I have tried both these suggestions.

  1. Using Aaron’s method, I have adapted the code and it compiles successfully, however the grid does not change colour as expected. I had a look at BackColor in Object Explorer and noticed it has the properties R, G and B - obviously Red, Green and Blue, so I tried changing these to different values but the code checker gave me “Compile failed” with the message “Property or indexer 'System.Drawing.Color.B' cannot be assigned to -- it is read only”.
  2. Using Calvin’s method I can change UseAppStyling to false, but there is no BackColor property on the grid properties. There is a BackColor property on the pane object that contains the grid, but setting this had no effect.

It is starting to look as if BackColor is somehow disabled from being user defined in our system, which is a damn nuisance!

Kind regards,

Peter

Userlevel 1

 

Peter -

Here are the Windows System colors (Name & Hex Value). 

Instead of using System.Drawing.Color.R 

try: System.Drawing.Color.Red

If you want to use the Hex values as there are more combinations, the code would be:

myItem.BackColor =  System.Drawing.ColorTranslator.FromHtml("#E9E9E9");

Let me know if this fixes the code.

Thanks,

Calvin

Userlevel 1

Hi Calvin,

Thanks once again for your input. I already tried setting grid.BackColor = System.Drawing.color.White. This compiled OK but when testing it the grid stayed the normal grey colour.

Kind regards,

Peter

Userlevel 1

Just tried grid.BackColor =  System.Drawing.ColorTranslator.FromHtml("#E9E9E9"); and got the same. Compiled OK but didn’t change the grid colour.

Kind regards,

Peter

Reply