The obliquing angle determines the forward or backward slant of the text. The angle represents the offset from its vertical axis (90 degrees). To set the obliquing angle, use the ObliquingAngle property to change a text style or the Oblique property of a text object. The obliquing angle must be provided in radians. A positive angle denotes a lean to the right, a negative value will have 2*PI added to it to convert it to its positive equivalent.
This example creates a single-line text object then slants it 45 degrees.
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
[CommandMethod("ObliqueText")]
public static void ObliqueText()
{
// Get the current document and database
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
// Start a transaction
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
// Open the Block table for read
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
OpenMode.ForRead) as BlockTable;
// Open the Block table record Model space for write
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
OpenMode.ForWrite) as BlockTableRecord;
// Create a single-line text object
using (DBText acText = new DBText())
{
acText.Position = new Point3d(3, 3, 0);
acText.Height = 0.5;
acText.TextString = "Hello, World.";
// Change the oblique angle of the text object to 45 degrees(0.707 in radians)
acText.Oblique = 0.707;
acBlkTblRec.AppendEntity(acText);
acTrans.AddNewlyCreatedDBObject(acText, true);
}
// Save the changes and dispose of the transaction
acTrans.Commit();
}
}