Watermarks are images that are displayed beneath or on top of all scene elements. You can add watermarks to the scene with the WatermarkCollection object. The Watermark object allows you to position the watermark at an arbitrary position in the control window. The following code creates a new watermark and adds it to the chart:
VB.NET | |
---|---|
|
C# | |
---|---|
|
By default the watermark will be positioned in the center of the chart. You can of course modify this by changing the HorizontalMargin and VerticalMargin properties of the Watermark object, which define the origin point of the watermark in percent values relative to the chart width and height, respectively. To properly position the watermark you, may also need to modify the HorzAlign and VertAlign properties as well, which define the alignment of the watermark with respect to the origin point. The following table shows how the origin point and the alignment of the watermark work together to define its position:
Horizontal Align Vertical Align |
Center | Left | Right |
Center | |||
Top | |||
Bottom |
The red lines in the images above represent the margins defined by the HorizontalMargin and VerticalMargin properties. For example, if you want to display the watermark at the upper left corner of the control, you should use left-horizontal and top-vertical alignment and zero for both horizontal and vertical margins:
VB.NET | |
---|---|
|
C# | |
---|---|
|
By default, watermarks are displayed on top of the chart, but you can alter this by changing the value of the AlwaysOnTop property. When set to false, the watermark will be displayed beneath the chart. You can also change the transparency of the watermark with the help of the SetTransparencyPercent method of the watermark's fill effect.
VB.NET | |
---|---|
|
C# | |
---|---|
|
This code will make the watermark semi-transparent.
Related Examples
Windows Forms: Watermarks\General
Web forms: Watermarks\General