Xceed Chart for WinForms v4.4 Documentation
Solid Color

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Fill Effects > Solid Color

Solid color is the simplest type of fill effect. Changing the color of an object with an assigned FillEffect is done with only one function call:

VB.NET  
fillEffect.SetSolidColor(Color.Green)
C#  
fillEffect.SetSolidColor(Color.Green);

The SetSolidColor function actually performs three steps. First, it changes the color property of the FillEffect object to green. Next, it changes the type of the fill effect to color. Finally, it modifies the material properties of the object so that it will also look green when you apply a lighting effect to the scene. Lighting and material properties are discussed in detail in the Lighting topics in the Users Guide and are beyond the scope of this topic.

As you can guess, you can perform all of these steps manually:

VB.NET  

fillEffect.Type = FillEffectType.Color

fillEffect.Color = Color.Green

C#  

fillEffect.Type = FillEffectType.Color;

fillEffect.Color = Color.Green;

This approach however is not recommended because it requires an additional function call and does not update some of the attached material properties. 

Let's illustrate the above with a few simple code examples:

VB.NET  

' change the chart background color

chartControl1.Background.FillEffect.SetSolidColor(Color.Blue)

 

' change the color of the back chart wall

Dim chart As Chart = CType((chartControl1.Charts(0)), Chart)

chart.Wall(ChartWallType.Back).FillEffect.SetSolidColor(Color.Azure)

 

' change the legend background color

Dim legend As Legend = CType((chartControl1.Legends(0)), Legend)

legend.Backplane.FillEffect.SetSolidColor(Color.MistyRose)

C#  

// change the chart background color

chartControl1.Background.FillEffect.SetSolidColor(Color.Blue);

 

// change the color of the back chart wall

Chart chart = (Chart)(chartControl1.Charts[0]);

chart.Wall(ChartWallType.Back).FillEffect.SetSolidColor(Color.Azure);

 

// change the legend background color

Legend legend = (Legend)(chartControl1.Legends[0]);

legend.Backplane.FillEffect.SetSolidColor(Color.MistyRose);

Related Examples

Windows Forms: Fill Effects\General

See Also

FillEffect | Xceed 3D Lighting Model | Working with Lights