but, if I could get a RichTextBox to do the same, I can hang with that. My
"John Hornick [MSFT]" <JHornick@online.microsoft.com> wrote in message
news:92Soo4PuDHA.1412@cpmsftngxa06.phx.gbl...
> Hi,
>
> GDI+'s text handling wasn't designed for this sort of work. If you need
> to do multi-format text in a single line, you're better off with GDI. This
> is explained in:
http://support.microsoft.com/?id=307208 (despite its
> title)
> That article should be required reading for anyone doing text output in
> GDI+ or System.Drawing. It explains the majority of the problems you'll
> face.
>
> To make your buffer scrollable, you could certainly double-buffer your
> drawing through a memory bitmap.
>
> When you update the form with Invalidate(), you're probably incurring a
> background repaint which is causing the "flash". I don't recall the
easiest
> way to tell the form not to redraw its background. In Win32, it would be a
> NULL background brush.
>
> Thanks,
> - John
> Microsoft Developer Support
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Visit
http://www.microsoft.com/security for current information on
security.
>
>
>
>
>
> > I'm trying to find a solution to this problem that has plagued me
for
> a
> > few months now.
> > Basically, I'm writing my own Telnet application, for starters, and I
need
> > to print formatted text to the background of the form. BitBlt was the
> > preferred method, but it was frought with problems. My solution is to
use
> > something along the lines of Texture brush and SolidBrushes. I'm also
> > choosing this method because I want to borrow a functionality from KDE,
to
> > be able to put a background picture into the window.
> > The three issues I'm having is:
> > 1) As we all know from Telnet apps using the ANSI method, a line may
have
> > multiple formatting applied to different words or even different letters
> of
> > a word. So, I'm figuring I'm probably going to have to print this out
> > letter by letter.
> > 2) I would like to have a scrollable buffer like the Multi-line
Textbox,
> so
> > the user can scroll up and down and keep information for a few hundred
> > lines, or whatever they choose to keep.
> > 3) When I print to the form, the form flashes. I believe this is due
to
> > the fact that I'm unsing the OnPaint event, and when I setup the
brushes,
> I
> > call Invalidate. I will post my code below, it's fairley short and
works
> in
> > it's present form....
> >
> > Dim textPath As GraphicsPath
> > Dim textRegion As Region
> > Dim backgroundBrush As TextureBrush
> > Dim forgroundBrush As SolidBrush
> > Dim OutputString As String
> > Private Sub Setup()
> > textPath = New GraphicsPath()
> > If TextBox1.Text = "" Then OutputString = "Welcome to my mind" Else
:
> > OutputString = TextBox1.Text
> > Application.DoEvents()
> > textPath.AddString(OutputString, FontFamily.GenericSerif, 0, 75, New
> > Point(10, 50), _ New StringFormat())
> > textRegion = New Region(textPath)
> > backgroundBrush = New TextureBrush(New Bitmap _
> > ("c:\WINNT\Coffee Bean.bmp"),WrapMode.Tile)
> > forgroundBrush = New SolidBrush(Color.Red)
> > Invalidate()
> > End Sub
> > Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
> > MyBase.OnPaintBackground(e)
> > Dim bgGraphics As Graphics = e.Graphics
> > bgGraphics.SetClip(textRegion, CombineMode.Exclude)
> > bgGraphics.FillRectangle(backgroundBrush, e.ClipRectangle)
> > bgGraphics.Dispose()
> > End Sub
> > Private Sub Form1_Load(ByVal sender As Object, ByVal e As
> System.EventArgs)
> > Handles MyBase.Load
> > Setup()
> > End Sub
> > Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
> > MyBase.OnPaint(e)
> > Dim fgGraphics As Graphics = e.Graphics
> > fgGraphics.FillRegion(forgroundBrush, textRegion)
> > fgGraphics.Dispose()
> > End Sub
> > Private Sub TextBox1_TextChanged(ByVal sender As Object, _
> > ByVal e As System.EventArgs) Handles TextBox1.TextChanged
> > Setup()
> > End Sub
> > Private Sub Form1_Resize(ByVal sender As Object, _
> > ByVal e As System.EventArgs) Handles MyBase.Resize
> > Setup()
> > End Sub
>
Outgoing mail is certified Virus Free.
).