Draw3dText(Graphics,string,Rectangle,SpecialEffectsTextStyle,SpecialEffectsTextAlignmentFlags,int,int,Color,Color,Color,Font,Image) Method

Summary
Draws three-dimensional text onto the target device context using the specified font, color, and style.
Syntax
C#
VB
C++
public void Draw3dText( 
   Graphics g, 
   string text, 
   Rectangle destRect, 
   SpecialEffectsTextStyle textStyle, 
   SpecialEffectsTextAlignmentFlags textAlignment, 
   int xDepth, 
   int yDepth, 
   Color textColor, 
   Color shadowColor, 
   Color hiliteColor, 
   Font textFont, 
   Image foreImage 
) 
Public Sub Draw3dText( 
   ByVal g As Graphics, 
   ByVal text As String, 
   ByVal destRect As Rectangle, 
   ByVal textStyle As SpecialEffectsTextStyle, 
   ByVal textAlignment As SpecialEffectsTextAlignmentFlags, 
   ByVal xDepth As Integer, 
   ByVal yDepth As Integer, 
   ByVal textColor As Color, 
   ByVal shadowColor As Color, 
   ByVal hiliteColor As Color, 
   ByVal textFont As Font, 
   ByVal foreImage As Image 
) 
public:  
   void Draw3dText( 
       Graphics^ g, 
      String^ text, 
      Rectangle^ destRect, 
      SpecialEffectsTextStyle^ textStyle, 
      SpecialEffectsTextAlignmentFlags^ textAlignment, 
      Int32 xDepth, 
      Int32 yDepth, 
      Color^ textColor, 
      Color^ shadowColor, 
      Color^ hiliteColor, 
      Font^ textFont, 
      Image^ foreImage 
   ) 

Parameters

g
The destination Graphics object.

text
Text string.

destRect
Rectangle to be used as the display destination rectangle.

textStyle
Text style. Use this parameter to control the style and justification of the three-dimensional text. For valid values refer to SpecialEffectsTextStyle.

textAlignment
Text Alignment, For valid values refer to SpecialEffectsTextAlignmentFlags.

xDepth
Horizontal shadow position.

yDepth
Vertical shadow position.

textColor
Value that specifies the text color.

shadowColor
Value that specifies the shadow color.

hiliteColor
Value that specifies the border color.

textFont
Font object that will be used for drawing the 3D text.

foreImage
Image object that will be used to place an image (such as a gradient) on the surface of the three-dimensional text. Use null to paint the color specified in textColor.

Remarks

Use the textStyle and textAlignment parameters to control the style and justification of the three-dimensional text. Use the textFont parameter to place an image (such as a gradient) on the surface of the three-dimensional text.

Drop shadows are available only for the following textStyle values:

  • DropShadow
  • BlockShadow
  • OutlineBlock

Shadow colors are available only for the following textStyle values:

  • InsetHeavy
  • InsetExtraHeavy
  • RaisedHeavy
  • RaisedExtraHeavy

Highlight colors are available only for the following textStyle values:

  • InsetLight
  • InsetExtraLight
  • InsetHeavy
  • InsetExtraHeavy
  • RaisedLight
  • RaisedExtraLight
  • RaisedHeavy
  • RaisedExtraHeavy
  • OutlineBlock

For general information, refer to Implementing Special Effects.

Example

This example shows the minimum requirements for using the Draw3dText(Graphics,String,Rectangle,SpecialEffectsTextStyle,SpecialEffectsTextAlignmentFlags,Int32,Int32,Color,Color,Color,Font,Image) method.

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.SpecialEffects; 
using Leadtools.Drawing; 
 
public void Draw3dText(Graphics g, Rectangle destRect) 
{ 
   SpecialEffectsProcessor processor = new SpecialEffectsProcessor(); 
 
   Font textFont = new Font("Arial", 24); 
 
   Image image = Image.FromFile(Path.Combine(LEAD_VARS.ImagesDir, "Ulay1.bmp")); 
 
   processor.Draw3dText(g, 
                        "3D Text - LEADTOOLS", 
                        destRect, 
                        SpecialEffectsTextStyle.DropShadow, 
                        SpecialEffectsTextAlignmentFlags.HorizontalCenter | SpecialEffectsTextAlignmentFlags.VerticalCenter, 
                        2, /* horizontal  shadow position */ 
                        2, /* vertical shadow position */ 
                        Color.Blue, /* text color, blue */ 
                        Color.Black,/* shadow color, black */ 
                        Color.White, /* border color, white */ 
                        textFont, 
                        image); 
 
   image.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.SpecialEffects 
Imports Leadtools.Drawing 
 
Public Sub Draw3dText(ByVal g As Graphics, ByVal destRect As Rectangle) 
   Dim processor As SpecialEffectsProcessor = New SpecialEffectsProcessor() 
 
   Dim textFont As Font = New Font("Arial", 24) 
 
   Dim img As Image = Image.FromFile(Path.Combine(LEAD_VARS.ImagesDir, "Ulay1.bmp")) 
 
   processor.Draw3dText(g, "3D Text - LEADTOOLS", destRect, SpecialEffectsTextStyle.DropShadow, SpecialEffectsTextAlignmentFlags.HorizontalCenter Or 
                        SpecialEffectsTextAlignmentFlags.VerticalCenter, 2, 2, Color.Blue, Color.Black, Color.White, textFont, img) 
 
   img.Dispose() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

Help Version 21.0.2021.3.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.SpecialEffects Assembly