private void showTextEntryForm() { DialogResult result = CYMessageBox.Show("Enter text to appear in current field on your AppleTV 4", "Text entry", CYMessageBox.CYButtons.OKCancel, CYMessageBox.CYIcon.Question); switch (result) { case DialogResult.OK: Debug.WriteLine(String.Format("entered text: {0}", Global.GlobalVar)); sendNavigationCommand("enterText=" + Uri.EscapeDataString(Global.GlobalVar) + ""); break; } }
static private void BuildMessageBox(string title) { newMessageBox = new CYMessageBox(); newMessageBox.Text = title; newMessageBox.Size = new System.Drawing.Size(400, 200); newMessageBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; newMessageBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; newMessageBox.Paint += new PaintEventHandler(newMessageBox_Paint); newMessageBox.BackColor = System.Drawing.Color.White; TableLayoutPanel tlp = new TableLayoutPanel(); tlp.RowCount = 4; tlp.ColumnCount = 0; tlp.Dock = System.Windows.Forms.DockStyle.Fill; tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22)); tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50)); tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50)); tlp.BackColor = System.Drawing.Color.Transparent; tlp.Padding = new Padding(2, 5, 2, 2); frmTitle = new Label(); frmTitle.Dock = System.Windows.Forms.DockStyle.Fill; frmTitle.BackColor = System.Drawing.Color.Transparent; frmTitle.ForeColor = System.Drawing.Color.White; frmTitle.Font = new Font("Tahoma", 9, FontStyle.Bold); frmMessage = new Label(); frmMessage.Dock = System.Windows.Forms.DockStyle.Fill; frmMessage.BackColor = System.Drawing.Color.White; frmMessage.Font = new Font("Tahoma", 9, FontStyle.Regular); frmMessage.Text = "hiii"; textEntry = new TextBox(); textEntry.Dock = System.Windows.Forms.DockStyle.Fill; textEntry.BackColor = System.Drawing.Color.White; textEntry.Font = new Font("Tahoma", 9, FontStyle.Regular); largeIcon = new IntPtr[250]; smallIcon = new IntPtr[250]; pIcon = new PictureBox(); ExtractIconEx("shell32.dll", 0, largeIcon, smallIcon, 250); flpButtons = new FlowLayoutPanel(); flpButtons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; flpButtons.Padding = new Padding(0, 5, 5, 0); flpButtons.Dock = System.Windows.Forms.DockStyle.Fill; flpButtons.BackColor = System.Drawing.Color.FromArgb(240, 240, 240); TableLayoutPanel tlpMessagePanel = new TableLayoutPanel(); tlpMessagePanel.BackColor = System.Drawing.Color.White; tlpMessagePanel.Dock = System.Windows.Forms.DockStyle.Fill; tlpMessagePanel.ColumnCount = 2; tlpMessagePanel.RowCount = 0; tlpMessagePanel.Padding = new Padding(4, 5, 4, 4); tlpMessagePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50)); tlpMessagePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); tlpMessagePanel.Controls.Add(pIcon); tlpMessagePanel.Controls.Add(frmMessage); tlp.Controls.Add(frmTitle); tlp.Controls.Add(tlpMessagePanel); tlp.Controls.Add(textEntry); tlp.Controls.Add(flpButtons); newMessageBox.Controls.Add(tlp); }