public void UpdateTileView() { var sameFocusColor = FontsTileView.TileFocusColor == Options.TileFocusColor; var sameSelectionColor = FontsTileView.TileHighlightColor == Options.TileSelectionColor; if (sameFocusColor && sameSelectionColor) { return; } FontsTileView.TileFocusColor = Options.TileFocusColor; FontsTileView.TileHighlightColor = Options.TileSelectionColor; FontsTileView.Invalidate(); }
private void OnSelect(object sender, TreeViewEventArgs e) { if (treeView.SelectedNode.Parent == null) { treeView.SelectedNode = treeView.SelectedNode.Nodes[0]; } int font = (int)treeView.SelectedNode.Tag; try { if ((int)treeView.SelectedNode.Parent.Tag == 1) { setOffsetsToolStripMenuItem.Visible = true; FontsTileView.VirtualListSize = 0x10000; } else { setOffsetsToolStripMenuItem.Visible = false; if (ASCIIText.Fonts[font] == null) { return; } var length = ASCIIText.Fonts[font].Characters.Length; FontsTileView.VirtualListSize = length; _fonts = new List <int>(length); for (int i = 0; i < ASCIIText.Fonts[font].Characters.Length; ++i) { _fonts.Add(i); } } } finally { UpdateStatusStrip(); FontsTileView.Invalidate(); } }
private void OnClickImport(object sender, EventArgs e) { if (FontsTileView.SelectedIndices.Count == 0) { return; } using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose an image file to import"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() != DialogResult.OK) { return; } Bitmap import = new Bitmap(dialog.FileName); if (import.Height > 255 || import.Width > 255) { MessageBox.Show("Image Height or Width exceeds 255", "Import", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } int font = (int)treeView.SelectedNode.Tag; if ((int)treeView.SelectedNode.Parent.Tag == 1) { UnicodeFonts.Fonts[font].Chars[FontsTileView.SelectedIndices[0]].SetBuffer(import); Options.ChangedUltimaClass["UnicodeFont"] = true; } else { ASCIIText.Fonts[font].ReplaceCharacter(FontsTileView.SelectedIndices[0], import); Options.ChangedUltimaClass["ASCIIFont"] = true; } FontsTileView.Invalidate(); } }