private void picPalette_MouseDown(object sender, MouseEventArgs e) { using (frmSelectColor frm = new frmSelectColor()) { if (frm.ShowDialog(this) == DialogResult.OK) { int x = Math.Min(e.X * 128 / picPalette.Width / 32, 31); int y = Math.Min(e.Y * 256 / picPalette.Height / 32, 31); int colorAddress = y * 4 + x; InteropEmu.DebugSetMemoryValue(DebugMemoryType.PaletteMemory, (uint)colorAddress, (byte)frm.ColorIndex); this.GetData(); this.RefreshViewer(); } } }
private void picPalette_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { using (frmSelectColor frm = new frmSelectColor()) { if (frm.ShowDialog(this) == DialogResult.OK) { int x = Math.Min(e.X * 128 / picPaletteBg.Width / 32, 31); int y = Math.Min(e.Y * 128 / picPaletteBg.Height / 32, 31); int colorAddress = y * 4 + x + (sender == picPaletteSprites ? 16 : 0); InteropEmu.DebugSetMemoryValue(DebugMemoryType.PaletteMemory, (uint)colorAddress, (byte)frm.ColorIndex); this.GetData(); this.RefreshViewer(); this.UpdateColorInformation(this._paletteIndex); } } } }