Ejemplo n.º 1
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            RadioButton rb = null;

            switch (e.KeyData)
            {
            case Keys.F:
                rb = rbFore;
                break;

            case Keys.B:
                rb = rbBack;
                break;

            case Keys.C:
                rb = rbChar;
                break;

            case Keys.A:
                rb = rbAttr;
                break;

            case Keys.O:
                rb = rbBoth;
                break;

            case Keys.Escape:
                Result    = false;
                e.Handled = true;
                this.Close();
                break;

            case Keys.Enter:
                if (colours.HasFocus && characterPanel.Visible)
                {
                    // now set character
                    charTextBox.Focus();
                }
                else
                {
                    Result    = true;
                    e.Handled = true;
                    this.Close();
                }
                break;
            }
            if (rb != null)
            {
                rb.Checked = true;
                e.Handled  = true;
                UpdateSelection();
            }
            base.OnKeyDown(e);
        }
Ejemplo n.º 2
0
        Control Characters()
        {
            var font    = CharacterHandler.CurrentPage.Font;
            int width   = 64;           //font.NumChars > 256 ? 64 : 32;
            var size    = new Size(width, (font.NumChars + width - 1) / width);
            var control = new FontTextBox(CharacterHandler, size);

            control.Bordered = true;
            control.SetAttribute(CharacterHandler.DrawAttribute);
            control.MouseDown += (sender, e) =>
            {
                if (lastSet != null)
                {
                    lastSet.Insert(control.CursorElement);
                    lastSet.Invalidate();
                    lastSet.Focus();
                }
                e.Handled = true;
            };
            control.ReadOnly = true;
            control.CanFocus = false;
            int character = 0;

            for (int y = 0; y < control.Canvas.Height; y++)
            {
                for (int x = 0; x < control.Canvas.Width; x++)
                {
                    if (character < font.NumChars)
                    {
                        var ce = control.Canvas[x, y];
                        ce.Character         = character++;
                        control.Canvas[x, y] = ce;
                    }
                }
            }

            return(control);
        }
Ejemplo n.º 3
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     Update();
     characters.Focus();
 }