AD
Administrator
Syncfusion Team
December 13, 2005 04:47 PM UTC
Hi Lori,
Essential Diagram uses a similar approach for drawing its RichTextNode object. To achieve a zoomed effect on the rendered text, we apply a scaling transformation to the destination Graphics object, render the contents of the RichText to a separate bitmap graphics object and then use Graphics.DrawImage to copy the contents of the text bitmap onto the destination Graphics. The following outline should give you an idea about the approach that we use,
// grfx is the destination graphics object
// Apply a scaling transformation to the Graphics
// using the zoom scale
// For a 200% zoom
Matrix zoomMtrx = new Matrix(2,0,0,2,0,0);
grfx.Transform = zoomMtrx;
// Create a bmp Graphics for the RichText control
System.Drawing.Rectangle txtbounds;
Bitmap textimage = new Bitmap(txtbounds.Width, txtbounds.Height);
Graphics bmpgrfx = Graphics.FromImage(textimage);
// Draw the RichText contents
this.DrawRichText(bmpgrfx, this.richTextCtl.Rtf, false, txtbounds, txtbounds, this.BackgroundColor, System.Drawing.Rectangle.Empty, true, 100);
bmpgrfx.Dispose();
// Now copy the contents of the text image onto the destination graphics object
PointF[] destPoints;
grfx.DrawImage( textimage, destPoints, new RectangleF( 0, 0, textimage.Width, textimage.Height), GraphicsUnit.Pixel, imgAttr );
textimage.Dispose();
grfx.ResetTransform();
grfx.Dispose()
Hope this helps.
Prakash Surendra
Syncfusion Inc.,