本帖最后由 HM刘磊 于 2013-4-18 23:29 编辑
- private void 邮件地址验证_Load(object sender, EventArgs e)
- {
- comboBox1.Items.Insert(0,PictureBoxSizeMode.AutoSize);
- comboBox1.Items.Insert(1,PictureBoxSizeMode.CenterImage);
- comboBox1.Items.Insert(2,PictureBoxSizeMode.Normal);
- comboBox1.Items.Insert(3,PictureBoxSizeMode.StretchImage);
- comboBox1.Items.Insert(4,PictureBoxSizeMode.Zoom);
-
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- switch (comboBox1.SelectedIndex)
- {
- case 0:
- PbBox.SizeMode = PictureBoxSizeMode.AutoSize;
- MessageBox.Show(comboBox1.SelectedIndex.ToString());
- return;
- case 1:
- PbBox.SizeMode = PictureBoxSizeMode.CenterImage;
- break;
- case 2:
- PbBox.SizeMode = PictureBoxSizeMode.Normal;
- break;
- case 3:
- PbBox.SizeMode = PictureBoxSizeMode.StretchImage;
- break;//在此设断点显示SizeMode属性已经获取到值。
- case 4:
- PbBox.SizeMode = PictureBoxSizeMode.Zoom;
- break;
- }
-
-
- }
复制代码 上面是主要代码,通过Combobox的SelectedIndexChanged事件来动态更改picturebox的SizeMode属性,但是我设断点显示属性以获取值。但是Picturebox还是原来的样子,没变化,求解。 |