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); }
void Update() { preview.Canvas.Fill(new CanvasElement(tool.CurrentCharacter, Handler.DrawAttribute)); preview.UpdateCanvasSize(); preview.Invalidate(); }