public Form1()
        {
            InitializeComponent();

            richtxt = new RichTextBox();
            richtxt.Parent = this.panel1;
            richtxt.SetBounds(0, 0, this.panel1.Width, this.panel1.Height);
            richtxt.Visible = false;

            Timer timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
        }
Example #2
0
        public static void ScrollableMsgBox(string promptText, string title)
        {
            Form form = new Form();
            RichTextBox txtMessage = new RichTextBox();
            Button buttonOk = new Button();

            txtMessage.Text = promptText;
            txtMessage.Enabled = true;
            txtMessage.Multiline = true;
            txtMessage.ReadOnly = true;

            buttonOk.Text = "OK";
            buttonOk.DialogResult = DialogResult.OK;

            txtMessage.SetBounds(5, 5, 450, 215);
            buttonOk.SetBounds(190, 225, 75, 23);

            txtMessage.AutoSize = true;
            buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            form.Text = title;
            form.ClientSize = new Size(450, 250);
            form.Controls.AddRange(new Control[] { txtMessage, buttonOk });
            form.ClientSize = new Size(Math.Max(300, txtMessage.Right + 5), form.ClientSize.Height);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.AcceptButton = buttonOk;
            form.ShowDialog();
        }