Beispiel #1
0
        public void OpenScreen(NsfUserScreen tela, int adjustX = 0, int adjustY = 0)
        {
            ShowBack();

            bool        alreadyInControls = false;
            UserControl toRemove          = null;

            foreach (var item in panelConteudo.Controls)
            {
                if (item is UserControl)
                {
                    if (item.GetType() == tela.GetType())
                    {
                        toRemove          = item as UserControl;
                        alreadyInControls = true;
                    }
                }
            }

            if (alreadyInControls)
            {
                panelConteudo.Controls.Remove(toRemove);
            }


            panelConteudo.Controls.Add(tela);
            panelConteudo.Controls.SetChildIndex(tela, 0);

            tela.Left = (panelConteudo.Width - tela.Width - adjustX) / 2;
            tela.Top  = (panelConteudo.Height - tela.Height - adjustY) / 2;


            if (tela is INsfUserScreenCadaster)
            {
                tela.Focus();
                ((INsfUserScreenCadaster)tela).SetFocus();
            }

            tela.OnOpenScreen();
        }
Beispiel #2
0
 public frmInicial(NsfUserScreen tela = null)
 {
     InitializeComponent();
     Current = this;
 }