View Single Post
  #7 (permalink)  
Old January 10th, 2012, 07:38 PM
Gary108 Gary108 is offline
Authorized User
Points: 193, Level: 3
Points: 193, Level: 3 Points: 193, Level: 3 Points: 193, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2011
Posts: 31
Thanks: 6
Thanked 0 Times in 0 Posts

Hi Rob,

In the following code, what does variable bm_source refer to? I assume that it is the name of the image that we are trying to resize to a 640 pixels by 900 pixels. If that is true, does it include the path, and in what format is it in?

Dim bm_dest As New Bitmap(640, 900)

'Make a Graphics object for the result Bitmap
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)

'Copy the source image into the destination bitmap
gr_dest.DrawImage(bm_source, 0, 0, 640, 900)

'Display the result.
picShowPicture.Image = bm_dest

Also, can you tell me how I can fill that variable (bm_source) using the OpenFileDialog box? The code I am presently using to select my image is:

Private Sub btnSelectPicture_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click

'Show the Open Dialog Box.
If ofdSelectPicture.ShowDialog = DialogResult.OK Then

'Load the picture into the picture box.
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName)

'Show the name of the file in the form's caption.
Me.Text = "Picture View(" & ofdSelectPicture.FileName & ")"

End If

As always I really appreciate your help. I couldn't do this without you.


Reply With Quote