GraphicComponent Color

Hi,
I’m trying to change the Color of a GraphicComponent from the ABB.Robotics.RobotStudio.Station namespace, but it raises an exception saying “The given key was not present in the dictionary.” Did anyone encounter this serious headache problem ever ?

Some code …

try{
GraphicComponent boxesGroup = activeStation.GraphicComponents["BoxGroup1"];
boxesGroup.Color = System.Drawing.Color.Red; //Raises the exception
}
catch(Exception ex){

}

Hi,

are you using VSTA or have you created your Add-In with Visual Studio?

VSTA does not support using types from the Windows.Drawing namespace.

To set the color of a graphic component you can use this method on the VSTABridge class:

public static void SetColor(
ProjectObject obj,
byte R,
byte G,
byte B
)

Thanks Niklas, that worked