I have some string to print on PrintDocument
using its graphic object using following code, and I'm expecting if rectangle area in small to fit whole string it show trim it with ellipses but the trimming is not applied to the drawn string, is there any thing wrong in the code? (If draw string on windows form it works)
PrintDocument printDocument;
void print_PrintPage(object sender, PrintPageEventArgs e)
{
var g = e.Graphics;
var rect = new Rectangle(10, 10, 50, 50);
g.DrawRectangle(Pens.Red, rect);
g.DrawString("Draws the specified text string at the specified position",
Font, Brushes.Red,
rect,
new StringFormat { Trimming = StringTrimming.EllipsisCharacter });
}
private void printPreviewControl_Click(object sender, EventArgs e)
{
printPreviewControl.Document = printDocument;
printPreviewControl.Show();
}