예제 #1
0
        /// <summary>
        /// Controls of the cursor: Arrow keys
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ViewHexaEditor_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.values != null)
            {
                int  t_selectedCase = SelectedCase;
                bool move           = false;
                switch (e.KeyData)
                {
                case Keys.Right:
                    if (SelectedCase + 1 < values.Length)
                    {
                        t_selectedCase += 1;
                        move            = true;
                    }
                    break;

                case Keys.Down:
                    if (SelectedCase + 16 < values.Length)
                    {
                        t_selectedCase += 16;
                        move            = true;
                    }
                    break;

                case Keys.Up:
                    if (SelectedCase - 16 >= 0)
                    {
                        t_selectedCase -= 16;
                        move            = true;
                    }
                    break;

                case Keys.Left:
                    if (SelectedCase - 1 >= 0)
                    {
                        t_selectedCase -= 1;
                        move            = true;
                    }
                    break;

                default:
                    break;
                }

                if (move)
                {
                    completeSelectedCase();
                    this.SelectedCase = t_selectedCase;
                    // Refresh pbx
                    RefreshOutput();
                    RefreshLabels();
                }

                Debug.Print(SelectedCase.ToString());
            }
        }
예제 #2
0
        /// <summary>
        /// Select the case by painting it
        /// </summary>
        /// <param name="rectanglesToFill"></param>
        /// <param name="values"></param>
        /// <param name="e"></param>
        public void selectCase(List <Rectangle> rectanglesToFill, string[] values, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            Debug.Print(SelectedCase.ToString());
            string c = values[SelectedCase];
            Brush  b = Brushes.White;

            if (this.Model.CharIsNotPrintable(c))
            {
                c = ".";
                b = Brushes.DimGray;
            }
            g.FillRectangle(Brushes.Blue, rectanglesToFill[SelectedCase]);
            g.DrawString(c, new Font("Tahoma", 8), b, rectanglesToFill[SelectedCase]);
        }