private void button13_Click(object sender, EventArgs e) { CsiBuilder cb1 = new CsiBuilder(txtAnsiStr.Text.Replace("\\x1B[", "\x1B[")); cb1.Insert(0, "ABCDE"); cb1.Insert(5, "FGHIJ"); cb1.Insert(3, "\x1B[91m12345\x1B[0m"); cb1.Insert(8, "VWXYZ"); cb1.InsertCommand(10, CsiCommands.ResetSGR); int idx = cb1.IndexOf(CsiCommands.ResetSGR); int[] arr = cb1.IndexesOf(); txtCsi.Text = $"Items Count:{cb1.Count}, Length:{cb1.CharLength}/{cb1.Length}, New Insert Reset @ {idx}{Environment.NewLine}"; idx = 0; for (int i = 0; i < cb1.Count; i++) { txtCsi.Text += $"[{i:D2}] -[{idx:D3}] {(cb1[i].Replace("\x1B", "\\x1B").Replace("\r", "\\r").Replace("\n", "\\n"))}{Environment.NewLine}"; idx += cb1[i].StartsWith("\x1B[") ? 1 : cb1[i].Length; } txtCsi.Text += $"CSI Indexes:{Environment.NewLine}{string.Join<int>(", ", arr)}{Environment.NewLine}"; }
private void btnShowMsgBox_Click(object sender, EventArgs e) { labDialogResult.Text = string.Empty; MessageBoxButtons btn = (MessageBoxButtons)Enum.Parse(typeof(MessageBoxButtons), cbMsgBoxBtn.Text); MessageBoxIcon icon = (MessageBoxIcon)Enum.Parse(typeof(MessageBoxIcon), cbMsgBoxIcon.Text); MessageBoxDefaultButton defBtn = (MessageBoxDefaultButton)Enum.Parse(typeof(MessageBoxDefaultButton), cbMsgBoxDefBtn.Text); if (chkFont.Checked) { MessageBox.Font = new Font((FontFamily)cbMsgBoxFont.SelectedItem, (float)cbMsgBoxFontSize.SelectedItem); } else if (MessageBox.Font != null) { MessageBox.Font = null; } string msg = txtMsgBoxText.Text.Replace("\\x1b", "\\x1B").Replace("\\x1B", "\x1B"); System.Windows.Forms.MessageBox.Show(msg, "Original MessageBox", btn, icon, defBtn); MessageBox.Show(this, msg, "Owner MessageBox", btn, icon, defBtn); labDialogResult.Text = MessageBox.Show(CsiBuilder.GetPureText(msg), txtMsgBoxCaption.Text, btn, icon, defBtn).ToString(); labDialogResult.Text = MessageBox.Show(msg, txtMsgBoxCaption.Text, btn, icon, defBtn).ToString(); }