By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,382 Members | 1,645 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,382 IT Pros & Developers. It's quick & easy.

How to set the font in a printdocument with the font dialog?

P: n/a
For the following document print handler I would like to enable changing the
font with some external event. The font dialog returns a font, but I don't
understand how to equate that return with "myfont".. All my documentation
concerns the fontproperty of a control. But my printdocument has no font
property.

Dim myfont As New Font("Arial", 10)

Private Sub PrintDocument2_PrintPage(ByVal sender As System.Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles _
PrintDocument2.PrintPage
e.Graphics.DrawString("string",myfont, Brushes.Black, x , y)
End Sub

How is this done?
--
mark
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"mark" <ma**@discussions.microsoft.com> schrieb:
For the following document print handler I would like to enable changing
the
font with some external event. The font dialog returns a font, but I don't
understand how to equate that return with "myfont".. All my documentation
concerns the fontproperty of a control. But my printdocument has no font
property.
\\\
Private m_MyFont As New Font(...)
..
..
..
Dim f As New FontDialog()
f.Font = m_MyFont
If f.ShowDialog() = DialogResult.OK Then
m_MyFont = f.Font
End If
///
Private Sub PrintDocument2_PrintPage(ByVal sender As System.Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles _
PrintDocument2.PrintPage
e.Graphics.DrawString("string",myfont, Brushes.Black, x , y)
'myfont' -> 'm_MyFont'.
End Sub


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.