Chart for .NET / User's Guide / Layout / Content Panels / Paint Effects

Paint Effects

Paint effects are primarily used with gauges, as they emulate a glass cap over a gauge instrument, which produces a more photo realistic image. In Nevron Chart for .NET all content panels can have a paint effect, which is applied after the panel content is painted.

The component supports two types of paint effects – gel and glass. The first one emulates a gel placed above the panel and the second one emulates the reflection of a glass cap.

 Gel Effect

The following picture shows two linear gauges with applied gel effect. The difference is in the margins and corner rounding of the gel effect:

The following code shows how to apply a gel effect to a panel with altered default settings:

C#
Copy Code
nChartControl1.Panels.Clear();
NNumericDisplayPanel displayPanel = new NNumericDisplayPanel();
displayPanel.BorderStyle = new NEdgeBorderStyle();
displayPanel.BackgroundFillStyle = new NColorFillStyle(Color.Black);
displayPanel.Margins = new NMarginsL(10, 10, 10, 10);
displayPanel.Padding = new NMarginsL(10, 10, 10, 10);
displayPanel.Value = 12345.67;
NGelEffectStyle gelEffect = new NGelEffectStyle();
gelEffect.Margins = new NMarginsL(new NLength(3), new NLength(3), new NLength(3), new NLength(60, NRelativeUnit.ParentPercentage));
gelEffect.CornerRounding = new NLength(10);
gelEffect.BeginColor = Color.FromArgb(125, Color.White);
gelEffect.EndColor = Color.FromArgb(30, Color.White);
displayPanel.PaintEffect = gelEffect;
nChartControl1.Panels.Add(displayPanel);
Visual Basic
Copy Code
nChartControl1.Panels.Clear()
Dim displayPanel As New NNumericDisplayPanel()
displayPanel.BorderStyle = New NEdgeBorderStyle()displayPanel.BackgroundFillStyle = New NColorFillStyle(Color.Black)displayPanel.Margins = New NMarginsL(10, 10, 10, 10)
displayPanel.Padding = New NMarginsL(10, 10, 10, 10)
displayPanel.Value = 12345.67
Dim gelEffect As New NGelEffectStyle()
gelEffect.Margins = New NMarginsL(New NLength(3), New NLength(3), New NLength(3), New NLength(60, NRelativeUnit.ParentPercentage))gelEffect.CornerRounding = New NLength(10)
gelEffect.BeginColor = Color.FromArgb(125, Color.White)
gelEffect.EndColor = Color.FromArgb(30, Color.White)
displayPanel.PaintEffect = gelEffect
NChartControl1.Panels.Add(displayPanel)
 Glass Effect

The glass effect emulates the reflection of a light source from glass cap. The following picture shows two radial gauges with applied glass effect:

The first gauge uses a glass effect with orientation of 135 degrees and light spread of 60 degrees, whereas the second one uses orientation of 45 degrees and light spread 90 degrees.

The following code shows how to apply a glass effect to a panel with altered default settings:

C#
Copy Code
nChartControl1.Panels.Clear();
NRadialGaugePanel radialGauge = new NRadialGaugePanel();
radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto);
radialGauge.BackgroundFillStyle = new NColorFillStyle(Color.Black);
NGlassEffectStyle glassEffect = new NGlassEffectStyle();
glassEffect.LightDirection = 120;
glassEffect.LightSpread = 70;
glassEffect.EdgeDepth = new NLength(20);
radialGauge.PaintEffect = glassEffect;
nChartControl1.Panels.Add(radialGauge);
Visual Basic
Copy Code
NChartControl1.Panels.Clear()
Dim radialGauge As New NRadialGaugePanel
radialGauge.BorderStyle = New NEdgeBorderStyle(BorderShape.Auto)
radialGauge.BackgroundFillStyle = New NColorFillStyle(Color.Black)

Dim glassEffect As New NGlassEffectStyle
glassEffect.LightDirection = 120
glassEffect.LightSpread = 70
glassEffect.EdgeDepth = New NLength(20)
radialGauge.PaintEffect = glassEffect
NChartControl1.Panels.Add(radialGauge
 Related Examples

Windows Forms: All Examples\Gauge Gallery\Gauges\Effects

Web Forms: All Examples\Gauge Gallery\Gauges\Effects

See Also