Exemplo n.º 1
0
        public FrmPrincipal()
        {
            InitializeComponent();

            /*
             * Código obtido no Stack Overlow para impedir que a imagem de fundo fique tremida(flicker)
             * https://stackoverflow.com/questions/1316310/mdi-parent-background-image
             */
            // as this code occurs in the Form's "Initialize()" function, any references to
            // "this." are to the Form instance itself (not the MDI control!)

            if (this.Controls.Count > 0)
            {
                MdiClient client = this.Controls.OfType <MdiClient>().First();
                client.BackgroundImageLayout = this.BackgroundImageLayout;
                client.Paint += (s, e) =>
                                e.Graphics.DrawImage(this.BackgroundImage, (s as MdiClient).ClientRectangle);

                //Set this to repaint when the size is changed
                typeof(Control).GetProperty(
                    "ResizeRedraw",
                    System.Reflection.BindingFlags.NonPublic |
                    System.Reflection.BindingFlags.Instance
                    ).SetValue(client, true, null);

                //set this to prevent flicker
                typeof(Control).GetProperty(
                    "DoubleBuffered",
                    System.Reflection.BindingFlags.NonPublic |
                    System.Reflection.BindingFlags.Instance
                    ).SetValue(client, true, null);
            }



            // Carregar a splash screen e o formulário de login antes do sistema iniciar.
            //this.Visible = false;
            //this.Hide();

            //SplashScreen splash = new SplashScreen();
            //splash.principal = this;
            //splash.ShowDialog();

            //FrmLogin login = new FrmLogin();
            //login.principal = this;
            //login.ShowDialog();

            // Ativar a dashboard como formulário padrão
            FrmDashboard dashboard = new FrmDashboard();

            Helper.StartForm(dashboard, this, FormWindowState.Maximized);
        }
Exemplo n.º 2
0
        private void inicioToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmDashboard dash = new FrmDashboard();

            Helper.StartForm(dash, this);
        }