THIS IS HTML - Problem displaying text in a picturebox

  • Thread starter Thread starter active
  • Start date Start date
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
 
Revised. Added the next to last line below
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 (picDisplay is a picturebox):

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 I change the Picturebox clientsize and the Bitmap as above to the size required for the string

Then draw the string
 
Hi Active,

If I was you I would post it again and than with another subject,
I thought it was a HTML problem displaying an image in a picturebox.

Although I maybe can help you, there are better for this subject I think.


Cor
 
I know in the past some people did not like to download HTML so I warned
them.
Maybe it's no longer a problem so I'll take your suggestion.

Cal
 
Back
Top