// 添加当前尺寸 private void MenuItem1_Click(object sender, EventArgs e) { Image img = pictureBoxMain.Image; Size S = (img == null ? Size.Empty : img.Size); addSize(ListBox_Size, S.Width, S.Height); ListBox_Size.SetItemChecked(ListBox_Size.Items.Count - 1, true); if (S != Size.Empty) { StatusTipInfo.Text = "已添加当前图像尺寸,到尺寸列表"; } }
// 添加新的尺寸,并选中 private void button_newSize_Click(object sender, EventArgs e) { try { int width = Int32.Parse(textBox_width.Text); int height = Int32.Parse(textBox_height.Text); addSize(ListBox_Size, width, height); ListBox_Size.SetItemChecked(ListBox_Size.Items.Count - 1, true); } catch (Exception) { } }