示例#1
0
        private void pictureZXDisplay_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.X < 0 || e.Y < 0)
            {
                return;
            }

            string numberFormat = this.hexNumbersToolStripMenuItem.Checked ? "#{0:X2}" : "{0}";

            int Xcoor = (e.X + 1) / 2;
            int Ycoor = (e.Y + 1) / 2;

            if (!isSpriteViewType())
            {
                ushort screenAdress = GraphicsTools.getScreenAdress(Xcoor, Ycoor);
                textBoxScreenAddress.Text = String.Format(numberFormat, screenAdress);

                ushort attributeAdress = GraphicsTools.getAttributeAdress(Xcoor, Ycoor);
                textBoxAttributeAddress.Text = String.Format(numberFormat, attributeAdress);

                if (this.hexNumbersToolStripMenuItem.Checked)
                {
                    textBoxXCoorYCoor.Text    = String.Format("#{0:X2}; #{1:X2}", Xcoor, Ycoor);
                    textBoxBytesAtAdress.Text = String.Format("#{0:X2}", _spectrum.ReadMemory(screenAdress));
                }
                else
                {
                    textBoxXCoorYCoor.Text    = String.Format("{0}; {1}", Xcoor, Ycoor);
                    textBoxBytesAtAdress.Text = String.Format("{0}", _spectrum.ReadMemory(screenAdress));
                }

                for (ushort memValue = (ushort)(screenAdress + 1); memValue < screenAdress + 5; memValue++)
                {
                    textBoxBytesAtAdress.Text += "; " + String.Format(numberFormat, _spectrum.ReadMemory(memValue));
                }
            }
            else if (comboDisplayType.SelectedIndex == 1) //only Sprite View for now...ToDo other view types, e.g. Jetpac type
            {
                int    zoomFactor             = (int)numericUpDownZoomFactor.Value;
                ushort addressPointer         = Convert.ToUInt16(numericUpDownActualAddress.Value);
                int    addressUnderCursorBase = addressPointer + (Convert.ToByte(comboSpriteWidth.SelectedItem) / 8) * (Ycoor) + (Xcoor / 8); //ToDo: zooming will crash this !
                ushort addressUnderCursor     = Convert.ToUInt16(addressUnderCursorBase > 0xFFFF ? addressUnderCursorBase - 0xFFFF: addressUnderCursorBase);

                //Sprite address
                textBoxSpriteAddress.Text = String.Format("#{0:X2}({1})", addressUnderCursor, addressUnderCursor);

                //Bytes at address
                textBoxSpriteBytes.Text = String.Format("#{0:X2}", _spectrum.ReadMemory(addressUnderCursor));
                for (ushort memValue = (ushort)(addressUnderCursor + 1); memValue < addressUnderCursor + 5; memValue++)
                {
                    textBoxSpriteBytes.Text += "; " + String.Format("#{0:X2}", _spectrum.ReadMemory(memValue));
                }
            }

            if (comboDisplayType.SelectedIndex == 0 && _mouseSelectionArea != null)  //for ScreenView only - update selection area if is cropping
            {
                _mouseSelectionArea.MouseMove(ref pictureZXDisplay, e);
            }
        }