private void RefreshSprite() { // Get the sprite indices int bank = cboBank.SelectedIndex; int chr = indexmap[cboChar.SelectedIndex]; int sprite = cboSprite.SelectedIndex; int oam = cboOam.SelectedIndex; // Try getting the sprite Bitmap bmp = SpriteData.GetSprite(bank, chr, sprite, cboPalNum.SelectedIndex, true); pSprite.Image = null; pOam.Image = null; if (bmp != null) { // Stretch the sprite according to our zoom zoom = (int)Math.Pow(2, tbZoom.Value); Bitmap bmpZoom = new Bitmap(bmp.Width * zoom, bmp.Height * zoom, PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bmpZoom); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half; g.DrawImage(bmp, new Rectangle(0, 0, bmpZoom.Width, bmpZoom.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel); // Show the sprite pSprite.Width = bmpZoom.Width; pSprite.Height = bmpZoom.Height; pSprite.Image = bmpZoom; } // Sprite arrangement if (oam < 0) { txtOamX.Text = ""; txtOamY.Text = ""; chkFlipH.Checked = false; chkFlipV.Checked = false; txtOamX.Enabled = false; txtOamY.Enabled = false; chkFlipH.Enabled = false; chkFlipV.Enabled = false; btnApply.Enabled = false; pOam.Image = null; } else { var si = SpriteInfo.InfoEntries[bank][chr].Sprites[sprite].Sprites[oam]; txtOamX.Text = si.CoordX.ToString(); txtOamY.Text = si.CoordY.ToString(); chkFlipH.Checked = si.FlipH; chkFlipV.Checked = si.FlipV; txtOamX.Enabled = true; txtOamY.Enabled = true; chkFlipH.Enabled = true; chkFlipV.Enabled = true; btnApply.Enabled = true; pOam.Image = SpriteData.GetOam(bank, chr, sprite, oam, cboPalNum.SelectedIndex, true); } }