Exemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////
        void btnRandom_Click(object sender, Controls.EventArgs e)
        {
            Window win = new Window(Manager);
              Button btn = new Button(Manager);
              TextBox txt = new TextBox(Manager);

              win.Init();
              btn.Init();
              txt.Init();

              win.ClientWidth = 320;
              win.ClientHeight = 160;

              win.MinimumWidth = 128;
              win.MinimumHeight = 128;

              Random r = new Random((int)Central.Frames);
              win.ClientWidth += r.Next(-100, +100);
              win.ClientHeight += r.Next(-100, +100);

              win.Left = r.Next(200, Manager.ScreenWidth - win.ClientWidth / 2);
              win.Top = r.Next(0, Manager.ScreenHeight - win.ClientHeight / 2);
              win.Closed += new WindowClosedEventHandler(win_Closed);

            /*
              win.Width = 1024;
              win.Height = 768;
              win.Left = 220;
              win.Top = 0;
              win.StayOnBack = true;
              win.SendToBack();
            */
              btn.Anchor = Anchors.Bottom;
              btn.Left = (win.ClientWidth / 2) - (btn.Width / 2);
              btn.Top = win.ClientHeight - btn.Height - 8;
              btn.Text = "OK";

              win.Text = "Window (" + win.Width.ToString() + "x" + win.Height.ToString() + ")";

              txt.Parent = win;
              txt.Left = 8;
              txt.Top = 8;
              txt.Width = win.ClientArea.Width - 16;
              txt.Height = win.ClientArea.Height - 48;
              txt.Anchor = Anchors.All;
              txt.Mode = TextBoxMode.Multiline;
              txt.Text = "This is a Multiline TextBox.\n" +
                 "Allows to edit large texts,\n" +
                 "copy text to and from clipboard,\n" +
                 "select text with mouse or keyboard\n" +
                 "and much more...";

              txt.SelectAll();
              txt.Focused = true;
              //txt.ReadOnly = true;

              txt.ScrollBars = ScrollBars.Both;

              win.Add(btn, true);
              win.Show();
              Manager.Add(win);
        }