现在我想要做的是选择你想要的尺寸,图片会改变。我做了一个例子,但它不会工作。
这是我的代码
Private Sub cboxpizzasize_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboxpizzasize.SelectedIndexChanged
Select Case cboxselectclass.SelectedItem
Case Is = "Personal - 4 slide"
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox1.Size = New Size(134, 150)
Case Is = "Regular - 6 slide"
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox1.Size = New Size(174.2, 196.95)
Case Is = "Large - 8 slide"
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox1.Size = New Size(214.4, 242.4)
Case Is = "Xtra Large - 12 slide"
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox1.Size = New Size(268, 303)
End Select
End Sub
答案 0 :(得分:0)
答案 1 :(得分:0)
在设计器中将SizeMode设置为StretchImage,然后使用以下代码:
Private Sub cboxpizzasize_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboxpizzasize.SelectedIndexChanged
Select Case cboxpizzasize.SelectedIndex
Case Is = 0
PictureBox1.Size = New Size(134, 150)
Case Is = 1
PictureBox1.Size = New Size(174.2, 196.95)
Case Is = 2
PictureBox1.Size = New Size(214.4, 242.4)
Case Is = 3
PictureBox1.Size = New Size(268, 303)
End Select
End Sub
(ComboBox名为cboxpizzasize,PictureBox为PictureBox1)