Xceed Chart for WinForms v4.4 Documentation
Welcome to Xceed Chart for WinForms v4.4 / User Guide / Lines and Frames / Shadows

In This Topic
    Shadows
    In This Topic

    Almost all objects visualized in the component support shadows. The shadow-related properties are wrapped in the Shadow object. Shadow can significantly increase the visual appearance of the control and are an indispensable feature in presentation quality charts. Shadow drawing however requires the control to perform a separate render pass for the object using the shadow. It is therefore not recommended to use shadows in high-performance applications or on scenes that have many objects. Furthermore, some shadow types are more expensive to render than others. 

    Following is a detailed explanation for each of the shadow properties.

    Shadow type

    The Shadow object's Type property controls the type of shadow to apply. The following code changes the shadow type to Gaussian:

    VB.NET  

    Dim shadow As Shadow =   someObjectSupportingShadows.Shadow

    shadow.Type = ShadowType.GaussianBlur

    C#  

    Shadow shadow = someObjectSupportingShadows.Shadow;

    shadow.Type = ShadowType.GaussianBlur;

    There are five shadow types as shown in the following table:

     

    ShadowType.None ShadowType.Solid ShadowType.LinearBlur
    ShadowType.GaussianBlur ShadowType.RadialBlur

     

     

    The above images show simple text and a rounded bar with applied gradient and different shadow styles.

    Solid shadow

    The solid shadow is the most common type of shadow used in applications. Its greatest advantage is that it is easy and fast to draw. The drawback is that some objects do not look good when using a solid shadow.

    Linear blur shadow

    The linear blur shadow uses a linear distribution at the shadow edges. The size of the smooth shadow area is controlled with the help of the FadeArea property of the Shadow object. Note that the linear blur shadow may use a convolution filter if the corresponding shape in GDI+ does not render well by using a PathGradientBrush with properly set focus point. That’s why the linear blur is slower than the solid shadow but is recommended over the more expensive types of shadows like Gausian and Radial, which always use convolution.

    Gaussian Blur Shadow

    The Gaussian blur shadow uses a Gaussian distribution (sometime also called normal distribution) at the shadow edges. The size of the smooth shadow area is controlled via the FadeArea property of the Shadow object. This type of shadow always uses convolution filters and is generally slower than the linear blur and solid types of shadows.

    Radial blur shadow

    The Radial blur shadow uses a radial distribution at the shadow edges. The size of the smooth shadow area is controlled via the FadeArea property of the Shadow object. This type of shadow always uses convolution filters and is generally slower than the linear blur and solid types of shadows.

    Shadow fade area

    The FadeArea property controls the size of the area where the shadow color distribution will operate. The color distribution function will start from the shadow color and gradually change its alpha value to completely transparent at the shadow edge. Note that blur-type shadows use convolution, which is computationally expensive. That’s why it’s recommended to keep the FadeArea in the range [1, 10] for better performance. The following code changes the FadeArea:

    VB.NET  
    shadow.FadeArea = 10
    C#  
    shadow.FadeArea = 10;

    When the fade area is set to 0 the control will render the object with a solid shadow.

    Shadow color

    After you choose the shadow type, you can also modify the shadow color:

    VB.NET  
    shadow.Color = Color.FromArgb(125, 0, 0, 0)
    C#  
    shadow.Color = Color.FromArgb(125, 0, 0, 0);

    In general shadows look better when the color is not completely opaque.

    Shadow offset

    The Offset property of the Shadow object controls the offset of the shadow from the original object in pixels and accepts a .NET PointF object:

    VB.NET  
    shadow.Offset = New PointF(10, 10)
    C#  
    shadow.Offset = new PointF(10, 10);

    Positive values for the X property will move the shadow leftwards. Positive values for the Y property will move the shadow downwards.

    See Also

    Shadow