コード例 #1
0
        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);
        }
コード例 #2
0
 private void TextureSelectionChanged(object sender, EventArgs e)
 {
     Mediator.Publish(EditorMediator.TextureSelected, TextureComboBox.GetSelectedTexture());
 }
コード例 #3
0
        private void GroupChanged(object sender, EventArgs e)
        {
            var tp = GroupComboBox.SelectedItem as TexturePackage;

            TextureComboBox.Update(tp == null ? null : tp.ToString());
        }
コード例 #4
0
 public TextureItem GetSelectedTexture()
 {
     return(TextureComboBox.GetSelectedTexture());
 }