Sign in to follow this  

Image Size in VB .Net

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this