private void colorToLibraryButton_Click(object sender, EventArgs e) { HSVColor [] colors = new HSVColor[4]; colors[0] = AdjustedColor(0); colors[1] = AdjustedColor(1); colors[2] = AdjustedColor(2); colors[3] = AdjustedColor(3); string tilename; string colorname; TreeNode selectedNode = libraryTreeView.SelectedNode; if (selectedNode.Tag != null) { colorname = selectedNode.Text; tilename = selectedNode.Parent.Text; } else { tilename = Path.GetFileNameWithoutExtension(currentTileName); colorname = ""; } using (TileColorPrompt dlg = new TileColorPrompt()) { dlg.TileName = tilename; dlg.ColorName = colorname; if (dlg.ShowDialog() == DialogResult.OK) { tilename = dlg.TileName; colorname = dlg.ColorName; library.AddEntry(tilename, colorname, colors); LibraryToTreeview(); } } }