Back to Devexpress

PageWatermark.TextDirection Property

corelibraries-devexpress-dot-xtraprinting-dot-drawing-dot-pagewatermark-a7257795.md

latest6.2 KB
Original Source

PageWatermark.TextDirection Property

Gets or sets the incline of the PageWatermark‘s text.

Namespace : DevExpress.XtraPrinting.Drawing

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[DefaultValue(DirectionMode.ForwardDiagonal)]
public DirectionMode TextDirection { get; set; }
vb
<DefaultValue(DirectionMode.ForwardDiagonal)>
Public Property TextDirection As DirectionMode

Property Value

TypeDefaultDescription
DirectionModeForwardDiagonal

A DirectionMode enumeration value representing the text incline.

|

Available values:

NameDescription
Horizontal

Specifies an incline from left to right.

| | ForwardDiagonal |

Specifies an incline from upper right to lower left.

| | BackwardDiagonal |

Specifies an incline from upper left to lower right.

| | Vertical |

Specifies an incline from top to bottom.

|

Remarks

This member is only in effect for a text watermark.

Example

This example demonstrates how to add a watermark to a printing system document. The SetTextWatermark method demonstrates the properties that are used to specify settings when a text watermark is added to a document, while the SetPictureWatermark method demonstrates the properties required to set a picture as a document’s watermark.

csharp
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.Drawing;
// ...

public void SetTextWatermark(PrintingSystem ps){
   // Create the text watermark.
   Watermark textWatermark = new Watermark();

   // Set watermark options.
   textWatermark.Text = "CUSTOM WATERMARK TEXT";
   textWatermark.TextDirection = DirectionMode.ForwardDiagonal;
   textWatermark.Font = new DXFont(textWatermark.Font.FontFamily, 40);
   textWatermark.ForeColor = Color.DodgerBlue;
   textWatermark.TextTransparency = 150;
   textWatermark.TextPosition = WatermarkPosition.InFront;
   textWatermark.PageRange = "1,3-5";

   // Add the watermark to the collection.
   ps.Watermarks.Add(textWatermark);
}

public void SetPictureWatermark(PrintingSystem ps){
   // Create the picture watermark.
   Watermark pictureWatermark = new Watermark();

   // Set watermark options.
   pictureWatermark.Image = Bitmap.FromFile("watermark.gif");
   pictureWatermark.ImageAlignment = ImageAlignment.TopCenter;
   pictureWatermark.ImageTiling = false;
   pictureWatermark.ImageViewMode = ImageViewMode.Stretch;
   pictureWatermark.ImageTransparency = 150;
   pictureWatermark.ImagePosition = WatermarkPosition.Behind;
   pictureWatermark.PageRange = "2,4";

   // Add the watermark to the collection.
   ps.Watermarks.Add(pictureWatermark);
}
vb
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraPrinting.Drawing
Imports DevExpress.Drawing
' ...

Public Sub SetTextWatermark(ByVal ps As PrintingSystem)
   ' Create the text watermark.
   Dim textWatermark As New Watermark()

   ' Set watermark options.
   textWatermark.Text = "CUSTOM WATERMARK TEXT"
   textWatermark.TextDirection = DirectionMode.ForwardDiagonal
   textWatermark.Font = New DXFont(textWatermark.Font.FontFamily, 40)
   textWatermark.ForeColor = Color.DodgerBlue
   textWatermark.TextTransparency = 150
   textWatermark.TextPosition = WatermarkPosition.InFront
   textWatermark.PageRange = "1,3-5"

   ' Add the watermark to the collection.
   ps.Watermarks.Add(textWatermark)
End Sub

Public Sub SetPictureWatermark(ByVal ps As PrintingSystem)
   ' Create the picture watermark.
   Dim pictureWatermark As New Watermark()

   ' Set watermark options.
   pictureWatermark.Image = Bitmap.FromFile("watermark.gif")
   pictureWatermark.ImageAlignment = ImageAlignment.TopCenter
   pictureWatermark.ImageTiling = False
   pictureWatermark.ImageViewMode = ImageViewMode.Stretch
   pictureWatermark.ImageTransparency = 150
   pictureWatermark.ImagePosition = WatermarkPosition.Behind
   pictureWatermark.PageRange = "2,4"

   ' Add the watermark to the collection.
   ps.Watermarks.Add(pictureWatermark)
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TextDirection property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-watermark-different-pages/CS/Form1.cs#L40

csharp
textWatermark.Text = text;
textWatermark.TextDirection = DirectionMode.ForwardDiagonal;
textWatermark.Font = new DXFont(textWatermark.Font.Name, 40);

reporting-winforms-watermark-different-pages/VB/Form1.vb#L42

vb
textWatermark.Text = text
textWatermark.TextDirection = DirectionMode.ForwardDiagonal
textWatermark.Font = New DXFont(textWatermark.Font.Name, 40)

See Also

PageWatermark Class

PageWatermark Members

DevExpress.XtraPrinting.Drawing Namespace