// Initialize protected override void Initialize() { _editBlueprintScrapShape = Parent as EditBlueprintScrapShape; System.Diagnostics.Debug.Assert(Parent is EditBlueprintScrapShape); System.Diagnostics.Debug.Assert(_editBlueprintScrapShape != null); System.Diagnostics.Debug.Assert(_textureUID != null); _spriteBatch = new SpriteBatch(GraphicsDevice); _pixel = new Texture2D(GraphicsDevice, 1, 1); _pixel.SetData <Color>(new[] { Color.White }); try { _texture = ResourceManager.getTexture(_textureUID); _textureCenter = new Vector2(_texture.Width, _texture.Height) / 2; } catch (ResourceNotFoundException ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Resource Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); FindForm().Close(); return; } // Resize form... int originalWidth = Width; int originalHeight = Height; Width = _texture.Width; Height = _texture.Height; int deltaWidth = Width - originalWidth; int deltaHeight = Height - originalHeight; Parent.Width += deltaWidth; Parent.Height += deltaHeight; }
// Initialize protected override void Initialize() { _editBlueprintScrapShape = Parent as EditBlueprintScrapShape; System.Diagnostics.Debug.Assert(Parent is EditBlueprintScrapShape); System.Diagnostics.Debug.Assert(_editBlueprintScrapShape != null); System.Diagnostics.Debug.Assert(_textureUID != null); _spriteBatch = new SpriteBatch(GraphicsDevice); _pixel = new Texture2D(GraphicsDevice, 1, 1); _pixel.SetData<Color>(new[] { Color.White }); try { _texture = ResourceManager.getTexture(_textureUID); _textureCenter = new Vector2(_texture.Width, _texture.Height) / 2; } catch (ResourceNotFoundException ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Resource Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); FindForm().Close(); return; } // Resize form... int originalWidth = Width; int originalHeight = Height; Width = _texture.Width; Height = _texture.Height; int deltaWidth = Width - originalWidth; int deltaHeight = Height - originalHeight; Parent.Width += deltaWidth; Parent.Height += deltaHeight; }
// Edit scrap shape private void defineShapeButton_Click(object sender, EventArgs e) { System.Diagnostics.Debug.Assert(selectedScrap != null); //try //{ // Create edit view editBlueprintScrapShapeView = new EditBlueprintScrapShape(this, selectedScrap); // Open edit view if (editBlueprintScrapShapeView.ShowDialog() == DialogResult.OK) { // Set scrap points selectedScrap.points = editBlueprintScrapShapeView.getPoints(); } // Close edit view editBlueprintScrapShapeView = null; //} //catch (ResourceNotFoundException ex) //{ // MessageBox.Show(ex.Message, "Resource Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} }