Image Size in VB .Net

Started by
3 comments, last by runnerbuddy2k8 18 years, 7 months ago
My problem is that I made an 800x600 picture to be drawn onto an 800x600 form, and it is somehow stretched to a little bit larger than 1024x768. Oddly enough this only occured with the images I made, but not one of the pictures that came with windows for the desktop. Any help would be greatly appreciated, because if I switch to 1024x768, my fps will go down greatly in animations. Here's the code I use to put my pictures on the form. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Select Case ScrData.CurScreen Case "Start Screen" e.Graphics.DrawImage(My.Resources.Start_Screen, 0, 0) Case "New Game" e.Graphics.DrawImage(My.Resources.New_Game_Screen, 0, 0) Case "Load Game" e.Graphics.DrawImage(My.Resources.Winter, 0, 0) End Select End Sub ScrData.CurScreen is my way of changing screens. Any help would be greatly appreciated.
Advertisement
bump

I could really use your help here.
Probably, the problem is DrawImage does some scaling I believe so the width and height of the image won't be the same when you draw it. This is so the image has the same size regardless of the resolution you have. Probably this will work

Dim rect As New Rectangle(0, 0, 800, 600)e.Graphics.DrawImage(image, rect)


Another problem is that the size of the form is 800x600 but counting the borders and stuff the drawing area will be a little smaller. SO just add a PictureBox object make it 800x600 and do your drawing there instead if you want the exact size
The thing is I set the form border to none, so there isn't a bar at the top saying the name of the game and such. Paint Shop Pro 9 just got to my house today, so I will see if it helps any.
Well this is extremely odd. Everything I make in Paint Shop Pro 9 is somehow stretched when put on the form using e.graphics.drawimage in vb .net 2005 beta 2. But when I copied the file into paint and saved it, it was fine. This happened with any graphics format I tried. Hopefully Microsoft fixes this before the have the final release of .net 2005.

Sorry about double post

This topic is closed to new replies.

Advertisement