private void Click_SignIn(Guna2Button butonLogin, ElementeGrafice elementeGrafice, Form form) { string username = textBoxUsernameOREmail.Text; string parola = textBoxParola.Text; int id = VariabileGlobale.bazaDeDate.ReturneazaIdUtilizator(username, parola); if (id != 0) { //pictureBoxAnimatie.Image= Image.FromFile(Application.StartupPath + @"\img\" + "unlock" + ".gif"); pictureBoxAnimatie.Image = Properties.Resources.unlock; pictureBoxAnimatie.Enabled = true; VariabileGlobale.utilizatorActiv = new Utilizator(VariabileGlobale.bazaDeDate, id); butonLogin.Text = "Logout"; elementeGrafice.AdaugareImagineLivrari(form); elementeGrafice.AdaugareImagineComenzi(form); elementeGrafice.AdaugareImagineDetaliiCont(form); elementeGrafice.AdaugareImagineCos(form); DateTime start = DateTime.Now; while ((DateTime.Now - start).TotalMilliseconds < 2000) { Application.DoEvents(); } this.Close(); } else { //pictureBoxAnimatie.Image = Image.FromFile(Application.StartupPath + @"\img\" + "lock" + ".gif"); pictureBoxAnimatie.Image = Properties.Resources._lock; pictureBoxAnimatie.Enabled = true; } }
private void OnClickMesa(object sender, EventArgs e) { Guna2Button mesas = (Guna2Button)sender; switch (mesas.Tag) { case "M1": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "M2": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "M3": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "M4": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "M5": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "M6": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "G1": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "G2": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "G3": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "G4": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "B1": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "B2": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "B3": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; case "B4": formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, (string)mesas.Tag)); break; } }
private void InitializareButoaneComenzi(int nrComenzi, int[] idComenzi, string[] AdreseComenzi, Form form) { for (int i = 0; i < nrComenzi; i++) { butoaneComenzi[i] = new Guna2Button { Width = 590, Height = 120, BorderRadius = 15, Dock = DockStyle.None, AutoSize = false, FillColor = Color.Transparent, Name = "panel_" + i, Cursor = Cursors.Hand, Animated = true }; butoaneComenzi[i].BorderRadius = 15; string idComanda = idComenzi[i].ToString(); int nrOrdine = i; butoaneComenzi[i].Click += (sender, EventArgs) => { Click_comanda_buton(sender, idComanda, AdreseComenzi[nrOrdine], form); }; tabelGeneralComenzi.Controls.Add(butoaneComenzi[i]); tabelGeneralComenzi.Height += butoaneComenzi[i].Height + 10; } form.Controls.Add(tabelGeneralComenzi); }
private void moveImageBox(object sender) { Guna2Button b = (Guna2Button)sender; imgSlide.Location = new Point(b.Location.X + 24, b.Location.Y - 25); imgSlide.SendToBack(); }
//picturebox hareket private void MoveImageSide(object sender) { Guna2Button button = (Guna2Button)sender; ImageSlide.Location = new Point(button.Location.X + 24, button.Location.Y - 25); ImageSlide.SendToBack(); }
private void btnEditHoTen_Click(object sender, EventArgs e) { if (AppState.state == Actions.NOTHING && currentEditButton == null) { currentEditButton = sender as Guna2Button; currentEditButton.Image = Presentation_Layer.Properties.Resources.accept; AppState.state = Actions.EDIT; tbHoTen.Enabled = true; this.AcceptButton = sender as Guna2Button; } else if (AppState.state == Actions.EDIT && currentEditButton == sender as Guna2Button) { try { string x = tbHoTen.Text; tbHoTen.Enabled = false; currentEditButton.Image = Presentation_Layer.Properties.Resources.edit; currentEditButton = null; AppState.state = Actions.NOTHING; User.Name = x; if (BLL_UserLogin.UpdateUserInFor()) { Notification.Show("Cập nhật thông tin thành công", Status.SUCCESS); } this.AcceptButton = null; } catch (Exception ex) { Notification.Show(ex.Message, Status.WARNING); } } }
void CreateMatrix() { Matrix = new List <List <Guna2Button> >(); Guna2Button OldBtn = new Guna2Button() { Width = 0, Height = 0, Location = new Point(-Cons.Margin, 0) }; for (int i = 0; i < Cons.DayOfColumn; i++) { Matrix.Add(new List <Guna2Button>()); for (int j = 0; j < Cons.DayOfWeek; j++) { Guna2Button btn = new Guna2Button() { Width = Cons.dateButtonWidth, Height = Cons.dateButtonHeight, Font = new Font("Segoe UI", 20, FontStyle.Bold), TabStop = false, BorderThickness = 0, FillColor = Color.Transparent, BorderRadius = 15 }; btn.Location = new Point(OldBtn.Location.X + OldBtn.Width + Cons.Margin, OldBtn.Location.Y); PanelMatrix.Controls.Add(btn); Matrix[i].Add(btn); OldBtn = btn; } OldBtn = new Guna2Button() { Width = 0, Height = 0, Location = new Point(-Cons.Margin, OldBtn.Location.Y + OldBtn.Height + Cons.Margin) }; } SetDefaultDate(); }
private void MoveImageBox(object sender) { Guna2Button b = (Guna2Button)sender; ImgSlide.Location = new Point(b.Location.X + 111, b.Location.Y - 72); ImgSlide.SendToBack(); }
public void loadNhomSanPham() { List <NhomSanPham> lstLoai = sp_bll.layDanhSachMaNhom(); int top = 10; for (int i = 0; i < lstLoai.Count; i++) { Guna2Button btnNhomSanPham = new Guna2Button() { BackColor = Color.Transparent, Dock = DockStyle.Left, FillColor = Color.Transparent, Font = new Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), ForeColor = Color.White, Location = new System.Drawing.Point(0, 0), Margin = new System.Windows.Forms.Padding(2), PressedColor = Color.Transparent, Size = new System.Drawing.Size(150, 39), TabIndex = 0, Animated = true, Tag = lstLoai[i].MaNhomSP, Text = lstLoai[i].TenNhom }; btnNhomSanPham.Click += BtnNhom_Click; pnNhomSanPham.Controls.Add(btnNhomSanPham); } }
private void moveImageBox(object sender) { Guna2Button c = (Guna2Button)sender; imageCurve.Location = new Point(c.Location.X + 166, c.Location.Y - 31); imageCurve.SendToBack(); }
private void btnEditTGBayToiThieu_Click(object sender, EventArgs e) { if (AppState.state == Actions.NOTHING && currentEditButton==null) { currentEditButton = sender as Guna2Button; currentEditButton.Image = Presentation_Layer.Properties.Resources.accept; AppState.state = Actions.EDIT; tbTGBayToiThieu.Enabled = true; this.AcceptButton = sender as Guna2Button; } else if (AppState.state == Actions.EDIT && currentEditButton == sender as Guna2Button) { try { int x = Convert.ToInt32(tbTGBayToiThieu.Text); tbTGBayToiThieu.Enabled = false; currentEditButton.Image = Presentation_Layer.Properties.Resources.edit; currentEditButton = null; AppState.state = Actions.NOTHING; ThamSo.TGBayToiThieu = x; if (BLL_ThamSo.UpdateThamSo()) Notification.Show("Chỉnh sửa quy định thành công", Status.SUCCESS); this.AcceptButton = null; } catch(Exception ex) { Notification.Show(ex.Message,Status.WARNING); showWarning(); } } }
public void moveImageBox(object sender) { Guna2Button b = (Guna2Button)sender; slideImg.Location = new Point(b.Location.X + 148, b.Location.Y - 32); slideImg.BringToFront(); slideImg.Visible = true; }
public void enableButtonAnswer() { foreach (var ctl in pnlAnwserGroup.Controls) { Guna2Button btn = (Guna2Button)ctl; btn.Click += new System.EventHandler(this.btn_Click); btn.FillColor = Color.FromArgb(0, 122, 204); } }
public void unableButtonAnswer() { foreach (var ctl in pnlAnwserGroup.Controls) { Guna2Button btn = (Guna2Button)ctl; btn.Click -= new System.EventHandler(this.btn_Click); btn.FillColor = Color.Gray; } }
// this function will change button color based on which button user pressed private void ChangeButtonColor(Guna2Button pressedButton, List <Guna2Button> listButtons) { // set all button to default color foreach (Guna2Button button in listButtons) { button.FillColor = DEFAULT_BUTTON_COLOR; } // set the pressed button to pressed button color pressedButton.FillColor = PRESSED_BUTTON_COLOR; }
/// <summary> /// Set infor of question into controls /// </summary> /// <param name="question"></param> public void setQuestion(Question question) { int i = 0; lblQuestion.Text = question.Content; foreach (Control ctl in pnlAnwserGroup.Controls) { Guna2Button btn = (Guna2Button)ctl; btn.Text = question.listAnswer[i++]; } }
private void btn_Click(object sender, EventArgs e) { choosed = true; //Check The player has chosen the answer unableButtonAnswer(); Guna2Button btn = (Guna2Button)sender; btn.FillColor = Color.Red; string nameBtn = (btn).Name; client.SendData(Utils.ObjectToByteArray(nameBtn[nameBtn.Length - 1].ToString())); }
public void showAnswerCorrect(AnswerCorrect answerCorrect) { foreach (var ctl in pnlAnwserGroup.Controls) { Guna2Button btn = (Guna2Button)ctl; if (btn.Text == answerCorrect.Content) { btn.FillColor = Color.Lime; } } }
private void ActivateButton(object senderButton) { if (senderButton != null) { //Button DisableButton(); currButton = (Guna2Button)senderButton; currButton.Font = new System.Drawing.Font("Roboto Medium", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //Border Button bottomBorderBtn.Location = new Point(currButton.Location.X, 49); bottomBorderBtn.Visible = true; bottomBorderBtn.BringToFront(); } }
private void ActivateButton(object senderBtn) { if (senderBtn == null) { return; } DisableButton(); currentBtn = (Guna2Button)senderBtn; //Active current button currentBtn.FillColor = Color.FromArgb(96, 141, 188); currentBtn.Checked = true; currentBtn.ShadowDecoration.Enabled = true; }
private Guna2Button CreareButon(int id, string nume, Form form, TableLayoutPanel tabelGeneralProduse) { Guna2Button buton = new Guna2Button { Name = "button_categorie_" + id, Text = nume, Width = 150, Height = 50, BorderRadius = 15, Margin = new Padding(0, 0, 0, 7), Cursor = Cursors.Hand }; buton.Click += (sender, EventArgs) => { Click(sender, form, tabelGeneralProduse); }; return(buton); }
void ClearMatrix() { for (int i = 0; i < Matrix.Count; i++) { for (int j = 0; j < Matrix[i].Count; j++) { Guna2Button btn = Matrix[i][j]; btn.Visible = true; btn.Text = ""; btn.BackColor = Color.Transparent; btn.ForeColor = Color.Black; btn.Click -= new EventHandler(PreviousBtn_Click); btn.Click -= new EventHandler(Nextbtn_Click); } } }
private void ActivateButton(object sender) { if (sender != null) { if (sender is Guna2Button && currentGunnaButton != (Guna2Button)sender) { DisableButton(); currentGunnaButton = (Guna2Button)sender; lbTenMenu.Text = currentGunnaButton.Text.ToUpper(); lbLink.Text = ""; currentGunnaButton.Checked = true; currentGunnaButton.ForeColor = SystemColors.ButtonHighlight; currentGunnaButton.Font = new Font("RobotoMono-Regular", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); } } }
private void OnClickBotoes(object sender, EventArgs e) { Guna2Button Botoes = (Guna2Button)sender; switch (Botoes.Tag) { case "Concluir": DialogResult FecharMesa = MessageBox.Show("Você Realmente deseja fechar esta mesa?", "Fechar Mesa", MessageBoxButtons.YesNo); if (FecharMesa == DialogResult.Yes) { this.FecharMesa(); } break; case "Voltar": this.formprincipal.addUserControl(new UC_DashboardVendas(formprincipal, this.CodigoMesa)); break; } }
//Methods private void ActivateButton(object senderBtn, Color color) { if (senderBtn != null) { DisableButton(); //Button currentBtn = (Guna2Button)senderBtn; currentBtn.BackColor = Color.Cornsilk; currentBtn.ForeColor = color; currentBtn.TextAlign = HorizontalAlignment.Center; currentBtn.ImageAlign = HorizontalAlignment.Right; //Left border button leftBorderBtn.BackColor = color; leftBorderBtn.Location = new Point(0, currentBtn.Location.Y); leftBorderBtn.Visible = true; leftBorderBtn.BringToFront(); } }
private void btnEditNgaySinh_Click(object sender, EventArgs e) { if (AppState.state == Actions.NOTHING && currentEditButton == null) { currentEditButton = sender as Guna2Button; currentEditButton.Image = Presentation_Layer.Properties.Resources.accept; AppState.state = Actions.EDIT; tbNgaySinh.Enabled = true; this.AcceptButton = sender as Guna2Button; } else if (AppState.state == Actions.EDIT && currentEditButton == sender as Guna2Button) { try { string x = tbNgaySinh.Text; string pattern = @"^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$"; if (Regex.IsMatch(x, pattern)) { tbNgaySinh.Enabled = false; currentEditButton.Image = Presentation_Layer.Properties.Resources.edit; currentEditButton = null; AppState.state = Actions.NOTHING; User.NgaySinh = DateTime.ParseExact(x, "dd/MM/yyyy", null); if (BLL_UserLogin.UpdateUserInFor()) { Notification.Show("Cập nhật thông tin thành công", Status.SUCCESS); } this.AcceptButton = null; } else { Notification.Show("Sai định dạng ngày tháng", Status.WARNING); showWarning("Sai Định Dạng", "Bạn cần nhập đúng định dạng ngày tháng"); } } catch (Exception ex) { Notification.Show(ex.Message, Status.WARNING); showWarning("Sai Định Dạng", "Bạn cần nhập đúng định dạng ngày tháng"); } } }
private void OnClickBotoes(object sender, EventArgs e) { Guna2Button Botoes = (Guna2Button)sender; switch (Botoes.Tag) { case "Cadastrar": this.Cadastrar(); break; case "Editar": this.Editar(); break; case "Limpar": this.LimparFormulario(); break; case "Excluir": this.Excluir(); break; case "Voltar": this.formprincipal.addUserControl(new UC_DashboardMesas(formprincipal)); break; case "Fechar": this.formprincipal.addUserControl(new UC_DashboardFecharMesa(formprincipal, CodigoMesa)); break; } }
private void btnEditSDT_Click(object sender, EventArgs e) { if (AppState.state == Actions.NOTHING && currentEditButton == null) { currentEditButton = sender as Guna2Button; currentEditButton.Image = Presentation_Layer.Properties.Resources.accept; AppState.state = Actions.EDIT; tbDienThoai.Enabled = true; this.AcceptButton = sender as Guna2Button; } else if (AppState.state == Actions.EDIT && currentEditButton == sender as Guna2Button) { try { string x = tbDienThoai.Text; string pattern = @"\d+"; if (Regex.IsMatch(x, pattern)) { tbDienThoai.Enabled = false; currentEditButton.Image = Presentation_Layer.Properties.Resources.edit; currentEditButton = null; AppState.state = Actions.NOTHING; User.DienThoai = x; if (BLL_UserLogin.UpdateUserInFor()) { Notification.Show("Cập nhật thông tin thành công", Status.SUCCESS); } this.AcceptButton = null; } else { Notification.Show("Sai định dạng số điện thoại", Status.WARNING); showWarning("Sai Định Dạng", "Bạn cần nhập đúng định dạng số điện thoại"); } } catch (Exception ex) { Notification.Show(ex.Message, Status.WARNING); } } }
private void ActivateButton(object senderBtn) { if (senderBtn == null) { return; } DisableButton(); currentButton = (Guna2Button)senderBtn; //Active current button currentButton.FillColor = Color.FromArgb(73, 90, 130); panel2.Location = currentButton.Location; currentButton.ImageAlign = HorizontalAlignment.Right; currentButton.Checked = true; //Change icon current child form pbChildForm.BackgroundImage = currentButton.Image; lbChildForm.Text = currentButton.Text; }
public static Guna2Button CreateGuna2Button(string nameCourse, int count) { Guna2Button button = new Guna2Button(); button.Location = new Point(count, 10); button.Name = nameCourse; button.Text = nameCourse; button.BackColor = Color.Transparent; button.Font = new Font("Century Gothic", 11F); button.ForeColor = Color.FromArgb(4, 148, 221); button.Height = 40; button.Animated = true; button.FillColor = Color.White; button.PressedColor = Color.Black; button.PressedDepth = 30; button.TextAlign = HorizontalAlignment.Center; return(button); }