Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bitmap scaling problem

Status
Not open for further replies.

mookie0001

Technical User
Jun 14, 2002
23
US
Hi everyone,

I am having a strange problem when drawing a bitmap to a picturebox. For some reason, when the bitmap is drawn - it is scaled larger than it's actual size. For example, if the screen resolution is set to 1024x768 and the image size is the same - the image will be rendered larger than 1024x768 in the picturebox. Thanks for your help in advance!

-Chris

Here is the relevant source code regarding my problem:

Dim gameboard_image As New Bitmap("e:\background.jpg")

Dim bufferBitmap = New Bitmap(gameboard_image.Width, gameboard_image.Height)

Private Sub gameboard_lg_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles gameBoard_lg.Paint

Dim bufferGraphics = Graphics.FromImage(bufferBitmap)

bufferGraphics.Clear(Color.Black)
bufferGraphics.DrawImageUnscaled(gameboard_image, m_dragOffset)

e.Graphics.DrawImageUnscaled(bufferBitmap, 0, 0)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top