private void UpdateControls() { ChartModeItem item = (ChartModeItem)chartModeComboBox.SelectedItem; if (item == null) { // initializing return; } AppSettings.Global.SetEnum(AppSettings.ASCCH_MODE, typeof(ChartMode), (int)item.Mode); // // Draw box contents. // const string hdr = "Dec Hex Chr"; const string div = " | "; const string eol = "\r\n"; StringBuilder sb = new StringBuilder( (hdr.Length * 4 + div.Length * 3 + eol.Length) * 32); sb.Append(hdr); sb.Append(div); sb.Append(hdr); sb.Append(div); sb.Append(hdr); sb.Append(div); sb.Append(hdr); for (int i = 0; i < 32; i++) { sb.Append(eol); DrawEntry(item.Mode, i, sb); sb.Append(div); DrawEntry(item.Mode, i + 32, sb); sb.Append(div); DrawEntry(item.Mode, i + 64, sb); sb.Append(div); DrawEntry(item.Mode, i + 96, sb); } sb.Append(eol); // easier to read the '_' at the bottom chartTextBox.Text = sb.ToString(); chartTextBox.SelectionStart = sb.Length; chartTextBox.SelectionLength = 0; }
private void UpdateControls() { ChartModeItem item = (ChartModeItem)chartModeComboBox.SelectedItem; if (item == null) { // initializing return; } AppSettings.Global.SetEnum(AppSettings.A2SC_MODE, typeof(ChartMode), (int)item.Mode); string text; switch (item.Mode) { case ChartMode.HiRes1_L: text = DrawHiRes(0x2000, true); break; case ChartMode.HiRes2_L: text = DrawHiRes(0x4000, true); break; case ChartMode.HiRes1_A: text = DrawHiRes(0x2000, false); break; case ChartMode.HiRes2_A: text = DrawHiRes(0x4000, false); break; case ChartMode.TextWithHoles: text = DrawText(); break; default: text = "UNKNOWN MODE"; break; } chartTextBox.Text = text; chartTextBox.SelectionStart = text.Length; chartTextBox.SelectionLength = 0; }