I m using vb 2005. I m importing a jpeg format image into form2. The image on the form will be dependant on the CustomerID. The CustomerID is taken from form1. I am also trying to allow user to select the size of the image by addding a combo box named ComboBox1.
The following is my code:
Form2
--------------------------
[CODE=vbnet]Sub Image(Byval CustomerID As String)
Dim theImage As Image
Dim filespec As String
Dim scaleToPercent As Integer
Dim imageAdjustment Percent As Decimal
Dim adjustedImageWi dth, adjustedImageHe ight As Integer
filespec = "C:\Documen ts and Settings\Gary\M y Documents\MP\" & CustomerID & ".jpeg"
theImage = Image.FromFile( filespec)
imageAdjustment Percent = (scaleToPercent / 100)
adjustedImageWi dth = (theImage.Width * imageAdjustment Percent)
adjustedImageHe ight = (theImage.Heigh t * imageAdjustment Percent)
theImage = theImage.GetThu mbnailImage(adj ustedImageWidth , adjustedImageHe ight, Nothing, Nothing)
PictureBox1.Ima ge = theImage
Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
scaleToPercent= ComboBox1.Text[/CODE]
The image doesnt resize when the text in the comboxbox changed.
Can someone edit my code so that the image resize once the integer in the comboxbox change.(default integer in combobox is 100)
The following is my code:
Form2
--------------------------
[CODE=vbnet]Sub Image(Byval CustomerID As String)
Dim theImage As Image
Dim filespec As String
Dim scaleToPercent As Integer
Dim imageAdjustment Percent As Decimal
Dim adjustedImageWi dth, adjustedImageHe ight As Integer
filespec = "C:\Documen ts and Settings\Gary\M y Documents\MP\" & CustomerID & ".jpeg"
theImage = Image.FromFile( filespec)
imageAdjustment Percent = (scaleToPercent / 100)
adjustedImageWi dth = (theImage.Width * imageAdjustment Percent)
adjustedImageHe ight = (theImage.Heigh t * imageAdjustment Percent)
theImage = theImage.GetThu mbnailImage(adj ustedImageWidth , adjustedImageHe ight, Nothing, Nothing)
PictureBox1.Ima ge = theImage
Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
scaleToPercent= ComboBox1.Text[/CODE]
The image doesnt resize when the text in the comboxbox changed.
Can someone edit my code so that the image resize once the integer in the comboxbox change.(default integer in combobox is 100)
Comment