We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

windows form print control - brushes -

Thread ID:

Created:

Platform:

Replies:

1153 Sep 27,2002 03:40 AM Windows Forms 0
loading
Tags: FAQ
aydinturker
Asked On September 27, 2002 03:40 AM

when print a text document, i want to choose my brushes(brushes.color). but how can i do this? ev.Graphics.DrawString(line, printFont, Brushes.Turquoise, leftMargin, yPos, New StringFormat()) '................... Public Class TextFilePrintDocument Inherits PrintDocument Private printFont As Font Private streamToPrint As StreamReader Public Sub New(ByVal streamToPrint As StreamReader) MyBase.New() Me.streamToPrint = streamToPrint End Sub Protected Overrides Sub OnBeginPrint(ByVal ev As PrintEventArgs) MyBase.OnBeginPrint(ev) printFont = New Font("Arial", 10) End Sub Protected Overrides Sub OnPrintPage(ByVal ev As PrintPageEventArgs) MyBase.OnPrintPage(ev) Dim lpp As Single = 0 Dim yPos As Single = 0 Dim count As Integer = 0 Dim leftMargin As Single = ev.MarginBounds.Left Dim topMargin As Single = ev.MarginBounds.Top Dim line As String Dim _colorDialog As New ColorDialog() Dim _brushColor As Brushes lpp = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics) line = streamToPrint.ReadLine() While ((count < lpp) And Not (line Is Nothing)) yPos = topMargin + (count * printFont.GetHeight(ev.Graphics)) ev.Graphics.DrawString(line, printFont, Brushes.Turquoise, leftMargin, yPos, New StringFormat()) count = count + 1 If (count < lpp) Then line = streamToPrint.ReadLine() End If End While If (line <> Nothing) Then ev.HasMorePages = True Else ev.HasMorePages = False End If End Sub End Class ' TextFilePrintDocument '...................

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;