/// <summary> /// Get a line of input from the user /// </summary> /// <param name="prompt"></param> /// <param name="title"></param> /// <param name="defaultText"></param> /// <param name="dictionary"></param> /// <param name="width"></param> /// <param name="height"></param> /// <returns>New input or null if cancelled</returns> public static string Show( string prompt, string title, string defaultText, List <string> dictionary, int width, int height) { string txt; if (Instance == null) { Instance = new InputBoxMx(); } if (width <= 0) { width = 337; } if (height <= 0) { height = 153; } Instance.Width = width; Instance.Height = height; if (WinFormsUtil.ControlMxConverter != null) { WinFormsUtil.ControlMxConverter(Instance, false); } if (prompt.Contains("</") || prompt.Contains("/>") || Lex.Contains(prompt, "<br>")) { // display HTML prompt Instance.Prompt.Visible = false; Instance.HtmlPrompt.Visible = true; string htmlFile = TempFile.GetTempFileName("html"); StreamWriter sw = new StreamWriter(htmlFile); int backColor = ((Instance.BackColor.R * 256 + Instance.BackColor.G) * 256) + Instance.BackColor.B; string hexColor = String.Format("#{0:X}", backColor); sw.Write("<body " + " topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' hspace='0' vspace='0' " + " style=\"font-size:8.5pt;font-family:'Tahoma';background-color:" + hexColor + "\">"); sw.Write(prompt); sw.Write("</body>"); sw.Close(); Instance.HtmlPrompt.Navigate(htmlFile); } else // display simple label prompt { Instance.HtmlPrompt.Visible = false; Instance.Prompt.Visible = true; Instance.Prompt.Text = prompt; } Instance.Text = title; Instance.Input.Text = defaultText; Instance.Input.Properties.Items.Clear(); if (dictionary != null) { Instance.Input.Properties.Items.AddRange(dictionary); } DialogResult dr = Instance.ShowDialog(Form.ActiveForm); // (SessionManager.ActiveForm); if (dr == DialogResult.Cancel) { return(null); } else { return(Instance.Input.Text); } }