Question PrintPreviewDialog Problem

madon

New member
Joined
May 1, 2012
Messages
1
Programming Experience
3-5
Hello ,
I'm new to this forum ,
i have a question about my vb.net project ,

this is my question :

i want to show RTF file in printpreviewdialog , i am able to show it but , when i get preview all text has lost its formatting , like Font , Size , Alignment etc..

so please help me , i want to preview text with its all formats (as it is in rtf) to printpreviewdialog ,
:erm:
this is my code ,(whatever i have done)
Untitled.jpg
VB.NET:
[/B]lenghty = Me.rtb.TextLength
        Dim printHeight As Integer = 1000
        Dim printWidth As Integer = 800
        Dim br As Brush = New SolidBrush(rtb.SelectionColor)
        e.Graphics.MeasureString(rtb.Text.Substring(curchar), rtb.Font, New SizeF(1000, 800), StringFormat.GenericTypographic, chars, lines)
        e.Graphics.DrawString(rtb.Text.Substring(curchar), rtb.Font, br, printarea, StringFormat.GenericTypographic)


        curchar += chars
        If curchar < lenghty Then
            e.HasMorePages = True
        Else
            e.HasMorePages = False
            curchar = 0
        End If
[B]



 
Top Bottom