private void TextureSelected(TextureItem selection) { var dis = SelectionPictureBox.Image; SelectionPictureBox.Image = null; //if (dis != null) dis.Dispose(); SizeLabel.Text = ""; if (selection == null || DocumentManager.CurrentDocument == null) { return; } TextureComboBox.SetSelectedTexture(selection); using (var tp = DocumentManager.CurrentDocument.TextureCollection.GetStreamSource(128, 128)) { var bmp = tp.GetImage(selection); if (bmp != null) { if (bmp.Bitmap.Width > SelectionPictureBox.Width || bmp.Bitmap.Height > SelectionPictureBox.Height) { SelectionPictureBox.SizeMode = PictureBoxSizeMode.Zoom; } else { SelectionPictureBox.SizeMode = PictureBoxSizeMode.CenterImage; } } SelectionPictureBox.Image = bmp.Bitmap; } SizeLabel.Text = string.Format("{0} x {1}", selection.Width, selection.Height); }
private void TextureSelectionChanged(object sender, EventArgs e) { Mediator.Publish(EditorMediator.TextureSelected, TextureComboBox.GetSelectedTexture()); }
private void GroupChanged(object sender, EventArgs e) { var tp = GroupComboBox.SelectedItem as TexturePackage; TextureComboBox.Update(tp == null ? null : tp.ToString()); }
public TextureItem GetSelectedTexture() { return(TextureComboBox.GetSelectedTexture()); }