• 9
• 16
• 15
• 12
• 9

# Image Size in VB .Net

This topic is 4589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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.

##### Share on other sites
bump

I could really use your help here.

##### Share on other sites
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

##### Share on other sites
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.