Ejemplo n.º 1
0
        public Waiting(BaseForm form = null)
        {
            Size            = Screen.PrimaryScreen.Bounds.Size;
            Location        = Screen.PrimaryScreen.Bounds.Location;
            FormBorderStyle = FormBorderStyle.None;
            BackColor       = Color.White;
            StartPosition   = FormStartPosition.Manual;
            TopMost         = true;
            AutoScaleMode   = AutoScaleMode.None;
            Font            = new Font(Fonts.HeshamAlSharq, 25);

            this.form = form;

            label = new Label {
                AutoSize  = false,
                TextAlign = ContentAlignment.BottomCenter,
                Location  = new Point(0, 100),
                Size      = new Size(this.Width, (this.Height / 3) / 2),
                Visible   = false,
            };

            button = new CommandButton(Resources.Close)
            {
                Location = new Point((this.Width - CommandButton.DefaultWidth) / 2, label.Bounds.Bottom + 20),
                Visible  = false,
            };
            button.Click += (s, e) => {
                if (form != null)
                {
                    form.Close();
                }
                Close();
            };

            picture = new PictureBox {
                Dock     = DockStyle.Fill,
                Name     = "picture",
                SizeMode = PictureBoxSizeMode.CenterImage,
                TabStop  = false,
                Image    = (Image)Resources.Waiting_2,
            };

            Controls.Add(picture);
            Controls.Add(label);
            Controls.Add(button);
        }
Ejemplo n.º 2
0
        public Footer(params string[] btns)
        {
            buttons = new CommandButton[btns.Length];

            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i] = new CommandButton(btns[i])
                {
                    Name    = btns[i],
                    TabStop = false
                };
            }

            var w = Screen.PrimaryScreen.Bounds.Width;
            var x = (w - CommandButton.DefaultWidth) / 2;

            switch (buttons.Length)
            {
            case 3:
                buttons[0].Location = new Point(10, 1);
                buttons[1].Location = new Point(x, 1);
                buttons[2].Location = new Point(w - 10 - CommandButton.DefaultWidth, 1);
                break;

            case 2:
                buttons[0].Location = new Point(10, 1);
                buttons[1].Location = new Point(w - 10 - CommandButton.DefaultWidth, 1);
                break;

            default:
                buttons[0].Location = new Point(x, 1);
                break;
            }

            Dock      = DockStyle.Bottom;
            Height    = CommandButton.DefaultHeight + 2;
            BackColor = Color.Transparent;
            Controls.AddRange(buttons);
        }