A
active
I draw text in a bitmap and then draw the bitmap on a picturebox and get text that is not all displayed the same.
Note the different text style in the (40, 100) area.
Got any insight into what is happening?
Cal
PS
I create a bitmap thusly:
Dim lDataBitmapGraphics As Graphics = picDisplay.CreateGraphics
mDisplayImage = New Drawing.Bitmap(picDisplay.Width, picDisplay.Height, lDataBitmapGraphics)
lDataBitmapGraphics.Dispose()
Then change the size to (40, 100) by doing the following after changing the picturebox clientsize
Private Sub AdjustBitmap()
If mDisplayImage Is Nothing Then Exit Sub
Dim lTmpBitmapGraphics As Graphics = picDisplay.CreateGraphics
Dim lTmpBitmap = New Drawing.Bitmap(picDisplay.ClientSize.Width, picDisplay.ClientSize.Height, lTmpBitmapGraphics)
lTmpBitmapGraphics.Dispose() 'Did this to preserver the PixelFormat
lTmpBitmapGraphics = Graphics.FromImage(lTmpBitmap) IS THESE FOUR LINES BETTER THAN THE LOWER TWO LINE??
'Dim lTmpBitmap As New Drawing.Bitmap(picDisplay.ClientSize.Width, picDisplay.ClientSize.Height) 'picDisplay.Width, picDisplay.Height)
'Dim lTmpBitmapGraphics As Graphics = Graphics.FromImage(lTmpBitmap)
lTmpBitmapGraphics.DrawImage(mDisplayImage, 0, 0)
mDisplayImage.Dispose()
lTmpBitmapGraphics.Dispose()
mDisplayImage = lTmpBitmap
picDisplay.Invalidate()
End Sub
Then draw the string
Note the different text style in the (40, 100) area.
Got any insight into what is happening?
Cal
PS
I create a bitmap thusly:
Dim lDataBitmapGraphics As Graphics = picDisplay.CreateGraphics
mDisplayImage = New Drawing.Bitmap(picDisplay.Width, picDisplay.Height, lDataBitmapGraphics)
lDataBitmapGraphics.Dispose()
Then change the size to (40, 100) by doing the following after changing the picturebox clientsize
Private Sub AdjustBitmap()
If mDisplayImage Is Nothing Then Exit Sub
Dim lTmpBitmapGraphics As Graphics = picDisplay.CreateGraphics
Dim lTmpBitmap = New Drawing.Bitmap(picDisplay.ClientSize.Width, picDisplay.ClientSize.Height, lTmpBitmapGraphics)
lTmpBitmapGraphics.Dispose() 'Did this to preserver the PixelFormat
lTmpBitmapGraphics = Graphics.FromImage(lTmpBitmap) IS THESE FOUR LINES BETTER THAN THE LOWER TWO LINE??
'Dim lTmpBitmap As New Drawing.Bitmap(picDisplay.ClientSize.Width, picDisplay.ClientSize.Height) 'picDisplay.Width, picDisplay.Height)
'Dim lTmpBitmapGraphics As Graphics = Graphics.FromImage(lTmpBitmap)
lTmpBitmapGraphics.DrawImage(mDisplayImage, 0, 0)
mDisplayImage.Dispose()
lTmpBitmapGraphics.Dispose()
mDisplayImage = lTmpBitmap
picDisplay.Invalidate()
End Sub
Then draw the string