R
Richard
Hi all,
I have a bitmap that I draw onto with text and stuff, and I copy the bitmap
to the form for display. I do this as form's in .net no longer have
autoredraw, so I keep my own copy of the image and then paint it to the form
in the Paint event. Here is how I set up the bitmap:
Dim mGraphics as Graphics
Dim mBitmap as Bitmap
In form load I do this:
mBitmap = New Bitmap(SystemInformation.WorkingArea.Width,
SystemInformation.WorkingArea.Height, Me.CreateGraphics())
mGraphics = Graphics.FromImage(mBitmap)
and I draw onto the bitmap with
mGraphics.DrawString(c, mFont, New SolidBrush(mForeGround), mX * mCharWidth,
mY * mCharHeight)
I update the form with
Me.CreateGraphics.DrawImage(mBitmap, 0, 0) ' update the form with the bitmap
This is all working beautifully, but I need to scroll the bitmap image up
by, say, 16 pixels. I have tried using DrawImage:
mGraphics.DrawImage(mBitmap, New Rectangle(0, 0, mBitmap.Width,
mBitmap.Height), New Rectangle(0, 16, mBitmap.Width, mBitmap.Height),
System.Drawing.GraphicsUnit.Pixel)
Me.CreateGraphics.DrawImage(mBitmap, 0, 0)
To me, the logic looks correct. I draw the portion of the bitmap starting
from 16 pixels down the image, back to the top of the bitmap, to simulate a
scrolling effect.
If anybody out there has any suggestions, please reply to this thread.
Thanks in advance,
Richard
I have a bitmap that I draw onto with text and stuff, and I copy the bitmap
to the form for display. I do this as form's in .net no longer have
autoredraw, so I keep my own copy of the image and then paint it to the form
in the Paint event. Here is how I set up the bitmap:
Dim mGraphics as Graphics
Dim mBitmap as Bitmap
In form load I do this:
mBitmap = New Bitmap(SystemInformation.WorkingArea.Width,
SystemInformation.WorkingArea.Height, Me.CreateGraphics())
mGraphics = Graphics.FromImage(mBitmap)
and I draw onto the bitmap with
mGraphics.DrawString(c, mFont, New SolidBrush(mForeGround), mX * mCharWidth,
mY * mCharHeight)
I update the form with
Me.CreateGraphics.DrawImage(mBitmap, 0, 0) ' update the form with the bitmap
This is all working beautifully, but I need to scroll the bitmap image up
by, say, 16 pixels. I have tried using DrawImage:
mGraphics.DrawImage(mBitmap, New Rectangle(0, 0, mBitmap.Width,
mBitmap.Height), New Rectangle(0, 16, mBitmap.Width, mBitmap.Height),
System.Drawing.GraphicsUnit.Pixel)
Me.CreateGraphics.DrawImage(mBitmap, 0, 0)
To me, the logic looks correct. I draw the portion of the bitmap starting
from 16 pixels down the image, back to the top of the bitmap, to simulate a
scrolling effect.
If anybody out there has any suggestions, please reply to this thread.
Thanks in advance,
Richard