Exemplo n.º 1
0
        public FrmIdioma(Principal principal)
        {
            try
            {
                InitializeComponent();

                this.IsEdit   = false;
                this.IsInsert = false;

                Image  image  = Image.FromFile(iconSystem);
                Bitmap bitmap = new Bitmap(image);
                this.Icon = Icon.FromHandle(bitmap.GetHicon());

                FormUtil.Resize(principal, this);

                idiomaDAO = new IdiomaDAO();

                idiomas = idiomaDAO.FindAllIdioma();

                image         = Image.FromFile(actionEdit);
                BtnEdit.Image = image;

                image = Image.FromFile(iconPosn);
                ValPosicionar.Image = image;

                image         = Image.FromFile(actionSave);
                BtnSave.Image = image;

                image          = Image.FromFile(actionClose);
                BtnClose.Image = image;

                image           = Image.FromFile(actionDelete);
                BtnDelete.Image = image;

                BtnEdit.Enabled   = true;
                BtnNew.Enabled    = false;
                BtnSave.Enabled   = false;
                BtnDelete.Enabled = false;

                this.principal = principal;

                PopulaDados();

                FrmUtil = new FormUtil(principal);
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(DataIdioma, ex.Message, "Erro Idiomas",
                                  MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void PopulaDados()
        {
            this.Cursor = Cursors.WaitCursor;
            DataIdioma.Rows.Clear();

            idiomas = idiomaDAO.FindAllIdioma();
            for (int i = 0; i < idiomas.Count; i++)
            {
                DataIdioma.Rows.Add();
                DataIdioma.Rows[i].Cells[0].Value           = idiomas[i].Spras;
                DataIdioma.Rows[i].Cells[0].ReadOnly        = true;
                DataIdioma.Rows[i].Cells[0].Style.BackColor = Color.LightSlateGray;
                DataIdioma.Rows[i].Cells[1].Value           = idiomas[i].Langu;
                DataIdioma.Rows[i].Cells[1].ReadOnly        = true;
                DataIdioma.Rows[i].Cells[1].Style.BackColor = Color.LightSlateGray;
                DataIdioma.Rows[i].Cells[2].Value           = idiomas[i].Denominacao;
                DataIdioma.Rows[i].Cells[2].ReadOnly        = true;
                DataIdioma.Rows[i].Cells[2].Style.BackColor = Color.LightGray;
            }
            DataIdioma.AllowUserToAddRows = false;
            this.Cursor = Cursors.Default;
            DataIdioma.Focus();
        }