private void createUI() { // Main style this.BackColor = Color.FromArgb(0, 102, 153); this.ColumnCount = 5; this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F)); this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F)); this.Dock = DockStyle.Top; this.RowCount = 1; this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.Size = new Size(this.Size.Width, 32); this.Margin = this.Padding = new Padding(0); // Adding other components this.previousButton = this.createNavigationButtonFromRessource(Resources.PagePrevious); this.Controls.Add(this.previousButton, 0, 0); this.nextButton = this.createNavigationButtonFromRessource(Resources.PageNext); this.Controls.Add(this.nextButton, 1, 0); this.refreshButton = this.createNavigationButtonFromRessource(Resources.PageRefresh); this.Controls.Add(this.refreshButton, 2, 0); this.homeButton = this.createNavigationButtonFromRessource(Resources.PageHome); this.Controls.Add(this.homeButton, 3, 0); this.textBoxURL = this.createTextBoxURL(); this.Controls.Add(this.textBoxURL, 4, 0); }
private void crearElementosMoneda(Moneda moneda, int y) { Label lblMonedaLabel = new Label() { // creando un nuevo label AutoSize = true, BackColor = System.Drawing.Color.White, Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), ForeColor = System.Drawing.Color.DodgerBlue, Margin = new System.Windows.Forms.Padding(2, 0, 2, 0), Size = new System.Drawing.Size(52, 14), // Modificar al gusto del cliente Name = "lbl" + moneda.idMoneda, Text = String.Format("1 {0} es igual a ... {1} ↓", monedaPorDefecto.moneda.ToUpper(), moneda.moneda.ToUpper()), Location = new System.Drawing.Point(25, (y + 8)), TabIndex = 93, }; BunifuMetroTextbox textMoneda1 = new BunifuMetroTextbox() { BackColor = System.Drawing.Color.White, BorderColorFocused = System.Drawing.Color.DodgerBlue, BorderColorIdle = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(157)))), ((int)(((byte)(157))))), BorderColorMouseHover = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(157)))), ((int)(((byte)(157))))), BorderThickness = 1, Cursor = System.Windows.Forms.Cursors.IBeam, Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))), isPassword = false, Margin = new System.Windows.Forms.Padding(4), Padding = new System.Windows.Forms.Padding(5, 18, 5, 0), Size = new System.Drawing.Size(350, 50), TextAlign = System.Windows.Forms.HorizontalAlignment.Left, // al gusto del cliente Location = new System.Drawing.Point(18, y), Name = moneda.idMoneda.ToString(), TabIndex = 91, Text = string.Format(CultureInfo.GetCultureInfo("en-US"), "{0:n" + 2 + "}", moneda.tipoCambio) //OnValueChanged += new System.EventHandler(this.bunifuMetroTextbox1_OnValueChanged); }; textMoneda1.OnValueChanged += new EventHandler(this.textMoneda1_OnValueChanged); // Agreganto los dos elementos this.panelContainer.Controls.Add(lblMonedaLabel); this.panelContainer.Controls.Add(textMoneda1); Control[] textMoneda3 = this.panelContainer.Controls.Find("1002", false); if (textMoneda3 != null) { BunifuMetroTextbox textMoneda14 = textMoneda3[0] as BunifuMetroTextbox; } }
private void urunekle_tb_Leave(object sender, EventArgs e) { /* Bu Fonksiyonda Hangi CheckBox'ta hareket olursa olsun PlaceHolder için içini kontrol ediyoruz. * Eğer boş ise ilk haline geri getiriyoruz.*/ string isim = ""; BunifuMetroTextbox gelen = (sender as BunifuMetroTextbox); isim = gelen.Name; if (gelen.Text == "") { if (gelen.Name == "btb_urunadi") { btb_urunadi.Text = "Ürün Adı"; } else if (gelen.Name == "btb_gelisfiyati") { btb_gelisfiyati.Text = "Geliş Fiyatı"; } else if (gelen.Name == "bfb_kategoriadi") { btb_kategoriadi.Text = "Kategori Adı"; } else { btb_birimfiyati.Text = "Birim Fiyatı"; } } }
private void textMoneda1_KeyPress(object sender, KeyPressEventArgs e) { BunifuMetroTextbox bunifuTexto = (BunifuMetroTextbox)sender; string texto = bunifuTexto.Text; Validator.isDecimal(e, texto); //Validator.isNumber(e); }
private void btnsaveclass_Click(object sender, EventArgs e) { ArrayList classList = new ArrayList(); ArrayList feearrayList = new ArrayList(); var clas = db.Randoms.Where(c => c.ID == 26).FirstOrDefault(); var fee = db.Randoms.Where(c => c.ID == 32).FirstOrDefault(); feearrayList.AddRange(fee.Text.Split(';')); for (int i = 0; i <= 15; i++) { string className = "txtclass" + (i + 1).ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(className, true).FirstOrDefault() as BunifuMetroTextbox; if (lbl_text.Text != "") { classList.Add(lbl_text.Text); } } string classess = String.Join(",", classList.ToArray()); int classlength = classList.ToArray().Length; int feelength = feearrayList.ToArray().Length; int min = classlength - feelength; for (int i = 1; i <= min; i++) { feearrayList.Add("0,0"); } string finalfee = String.Join(";", feearrayList.ToArray()); try { clas.Text = classess; fee.Text = finalfee; db.Entry(clas).State = System.Data.Entity.EntityState.Modified; db.Entry(fee).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } catch (Exception ex) { labelresult.Text = ex.Message.ToString(); labelresult.Visible = true; labelresult.ForeColor = Color.Red; } finally { labelresult.Text = "Saved Successfully!"; labelresult.Visible = true; labelresult.ForeColor = Color.Green; } }
public static void noSpace(Object obj) { BunifuMetroTextbox shit = (BunifuMetroTextbox)obj; if (string.IsNullOrWhiteSpace((string)shit.Text)) { shit.Text = string.Empty; } }
public static void AddTextBunifu(object sender, EventArgs e) { BunifuMetroTextbox myTxtbx = (BunifuMetroTextbox)sender; if (string.IsNullOrWhiteSpace(myTxtbx.Text)) { myTxtbx.Text = myTxtbx.Tag.ToString(); } }
private bool checkAdd() { string msg = ""; bool isEmpty = false; int count = 0; string[] condReqName = { "txtMobile", "txtPhone1", "txtPhone2" }; //判斷欄位三個至少填一個 string[] condName = { "txtName", "txtAddr", "txtMain" }; //必填欄位 foreach (Control c in this.Controls) { if (c is BunifuMetroTextbox) { BunifuMetroTextbox textBox = c as BunifuMetroTextbox; if (condName.Contains(textBox.Name) && textBox.Text == string.Empty) { msg = "欄位不能為空值!"; isEmpty = true; } else if (condReqName.Contains(textBox.Name) && textBox.Text == string.Empty) { count++; } } else if (c is BunifuDropdown) { BunifuDropdown dropdown = c as BunifuDropdown; if (dropdown.selectedIndex == -1) { msg = "欄位不能為空值!"; isEmpty = true; } } } if (count == condReqName.Length) { msg = "電話欄位至少輸入一欄!"; isEmpty = true; } if (!isEmpty && mode == mode.Add) { RosterInfo vRoster = new RosterInfo(APConfig.Conn); vRoster.Conditions = vRoster.getCondition(RosterInfo.ncConditions.main.ToString(), txtMain.Text); if (vRoster.calculateCount() > 0) { msg = "該手機號碼已經有資料!請重複確認!"; } } if (!string.IsNullOrEmpty(msg)) { APConfig.SweetAlert(ShowBoxType.alert, msg); } return(string.IsNullOrEmpty(msg)? true: false); }
public static void RemoveTextBunifu(object sender, EventArgs e) { BunifuMetroTextbox myTxtbx = (BunifuMetroTextbox)sender; if (myTxtbx.Text == myTxtbx.Tag.ToString()) { myTxtbx.Text = ""; } }
//set length of textBoxes https://stackoverflow.com/questions/49424788/how-to-set-max-length-for-bunifu-net-ui-framework-text-box public static void BunifuMetro(BunifuMetroTextbox metroTextbox, int length) { foreach (var ctl in metroTextbox.Controls) { if (ctl.GetType() == typeof(TextBox)) { var txt = (TextBox)ctl; txt.MaxLength = length; } } }
public static void ValidateLength(BunifuMetroTextbox textbox, KeyPressEventArgs e, int length) { if (char.IsControl(e.KeyChar)) { return; } if (textbox.Text.Length == length) { e.Handled = true; } }
private void mad_adet_enter(object sender, EventArgs e) { string isim = ""; BunifuMetroTextbox gelen = (sender as BunifuMetroTextbox); isim = gelen.Name; if (gelen.Text == "Masa İsmi") { gelen.Text = ""; } }
private void urunekle_tb_Enter(object sender, EventArgs e) { string isim = ""; BunifuMetroTextbox gelen = (sender as BunifuMetroTextbox); isim = gelen.Name; if (gelen.Text == "Ürün Adı" || gelen.Text == "Geliş Fiyatı" || gelen.Text == "Birim Fiyatı" || gelen.Text == "Kategori Adı" || gelen.Text == "Adet" || gelen.Text == "Kategori Adı") { gelen.Text = ""; } }
private void IntegerValidate(BunifuMetroTextbox Textbox, CancelEventArgs e) { Int16 num; if (!Int16.TryParse(Textbox.Text, out num)) { // Cancel the event and select the text to be corrected by the user. e.Cancel = true; Textbox.Select(); // Set the ErrorProvider error with the text to display. errorProvider1.SetError(Textbox, "Numeric only"); } }
public BunifuMetroTextbox CreateTextInput(ref int t) { BunifuMetroTextbox i = new BunifuMetroTextbox { Location = new Point(17, t), BorderColorFocused = Color.FromArgb(2, 186, 255), BorderColorMouseHover = Color.FromArgb(33, 150, 243), BorderThickness = 2, Height = 30 }; t += i.Height + 10; Controls.Add(i); return(i); }
//Personel Ekle Butonu İle Neler Olacağını Belirliyoruz. private void btn_personelekle_Click(object sender, EventArgs e) { //TextBoxların Enabled özelliklerine göre işlem yapıyoruz. Bu sebeple Personel Ekle buton Textine bakıyoruz. if (btn_personelekle.Text == "Personel Ekle") { if (bmt_adi.Text != "Personel Adı" && bmt_telefon.Text != "Telefon Numarası" && bmt_tckimlik.Text != "TC Kimnlik Numarası" && bmt_adres.Text != "Ev Adresi" && bmt_eposta.Text != "E-posta") { //Eğer bmt_sifre1 ve bmt_sifre2 aynı değilse diye kontrolü burada yapıyoruz. if ((bmt_sifre1.Text == bmt_sifre2.Text) || (bmt_sifre1.Text != "Şifre" && bmt_sifre2.Text != "Şifre Tekrarı")) { // Tüm şartlar sağlanırsa veritabanı.Personel_ekle fonksiyonunu çağırıyoruz if (veritabanı.P_sifre_Aynimi(bmt_sifre1.Text) && veritabanı.Personel_ekle(bmt_adi.Text, bmt_telefon.Text, bmt_tckimlik.Text, bmt_eposta.Text, bmt_adres.Text, bdp_dogumtarihi.Value.ToString("yyyy-MM-dd"), bmt_sifre1.Text, cGenel.yonetici_no)) { alarm.Show("Personel ekleme işlemi başarı ile tamamlandı.", alarm.Alarmtur.basarili); veritabanı.personel_getir(p_ad, p_id); Personel_btn_olustur(); lbl_pno.Text = veritabanı.personel_sayisi() + ""; lb_aciklama.Text = bmt_adi.Text + " personel olarak eklendi."; } else { alarm.Show("Personel ekleme işlemi başarısız.", alarm.Alarmtur.hata); } } else { alarm.Show("Şifreler birbiri ile aynı değil.", alarm.Alarmtur.dikkat); } } else { alarm.Show("Lütfen tüm alanları eksiksiz doldurun.", alarm.Alarmtur.hata); } } else if (btn_personelekle.Text == "Kilidi Kaldır") { BunifuMetroTextbox p_tarih = new BunifuMetroTextbox(); BunifuMetroTextbox[] text = { bmt_adi, bmt_telefon, bmt_tckimlik, bmt_adres, bmt_eposta, p_tarih }; String[] ic_metinler = { "Personel Adı", "Telefon Numarası", "TC Kimlik Numarası", "Ev Adresi", "E-posta" }; for (int i = 0; i < text.Length - 1; i++) { text[i].Enabled = true; text[i].Text = ic_metinler[i]; } btn_personelekle.Text = "Personel Ekle"; } }
private void Bw_DoWork(object sender, DoWorkEventArgs e) { ArrayList ClassArray = new ArrayList(); ArrayList FeeArray = new ArrayList(); var clas = db.Randoms.Where(c => c.ID == 26).FirstOrDefault(); var clasarray = clas.Text.Split(','); ClassArray.AddRange(clasarray); for (int i = 1; i <= ClassArray.ToArray().Length; i++) { string tfeeName = "tfee" + i.ToString(); BunifuMetroTextbox tfee_txt = this.Controls.Find(tfeeName, true).FirstOrDefault() as BunifuMetroTextbox; string efeeName = "efee" + i.ToString(); BunifuMetroTextbox efee_txt = this.Controls.Find(efeeName, true).FirstOrDefault() as BunifuMetroTextbox; string fee = tfee_txt.Text + "," + efee_txt.Text; FeeArray.Add(fee); } string up = String.Join(";", FeeArray.ToArray()); try { var fe = db.Randoms.Where(c => c.ID == 32).FirstOrDefault(); fe.Text = up.ToString(); db.Entry(fe).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); done = true; } catch (Exception ex) { result = ex.Message.ToString(); done = false; } finally { result = "Saved Successfully!"; } }
private BunifuMetroTextbox createTextBoxURL() { BunifuMetroTextbox textBox = new BunifuMetroTextbox(); textBox.BackColor = Color.FromArgb(20, 122, 173); textBox.BorderColorFocused = Color.FromArgb(20, 122, 173); textBox.BorderColorIdle = Color.FromArgb(20, 122, 173); textBox.BorderColorMouseHover = Color.FromArgb(20, 122, 173); textBox.BorderThickness = 1; textBox.Dock = DockStyle.Fill; textBox.Cursor = Cursors.IBeam; textBox.Font = new Font("Tahoma", 11F); textBox.ForeColor = Color.White; textBox.Margin = new Padding(0); return(textBox); }
public void LoadSections() { var sec = db.Randoms.Where(c => c.ID == 27).FirstOrDefault(); var secarr = sec.Text.Split(','); ArrayList Sectionarray = new ArrayList(); Sectionarray.AddRange(secarr); for (int j = 0; j <= Sectionarray.ToArray().Length - 1; j++) { string className = "txtsec" + (j + 1).ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(className, true).FirstOrDefault() as BunifuMetroTextbox; lbl_text.Text = Sectionarray[j].ToString(); } }
private void mad_adet_leave(object sender, EventArgs e) { string isim = ""; BunifuMetroTextbox gelen = (sender as BunifuMetroTextbox); isim = gelen.Name; if (gelen.Text == "") { if (gelen.Name == "Masa İsmi") { btb_degistir.Text = "Ürün Adı"; } } }
private string checkSubmit() { string msg = ""; string pattern = @"^[a-zA-Z0-9]+$"; //判斷只有英文數字 bool isEmpty = false; foreach (Control pages in this.Controls) { if (pages is Panel) { Panel panel = pages as Panel; if (panel.Name.ToString() == "panelSubmit") { foreach (Control c in pages.Controls) { if (c is BunifuMetroTextbox) { BunifuMetroTextbox textBox = c as BunifuMetroTextbox; if (textBox.Text == string.Empty) { msg = "欄位不能為空值!"; isEmpty = true; } else if (!Regex.Match(textBox.Text, pattern).Success) { msg = "欄位內容只能包含英文數字!"; isEmpty = true; } } } } } } if (!isEmpty && txtPassword.Text != txtPassword2.Text) { msg = "密碼輸入不相同!"; } if (!string.IsNullOrEmpty(msg)) { APConfig.SweetAlert(ShowBoxType.alert, msg); } return(msg); }
public static String toTitleCase(Object obj) { string newString = string.Empty; BunifuMetroTextbox txt = (BunifuMetroTextbox)obj; string s = (string)txt.Text; try { newString = newString + char.ToUpper(s[0]); for (int i = 1; i < s.Length; i++) { if (char.IsLower(s[i])) { newString = newString + s[i]; } if (char.IsUpper(s[i])) { newString = newString + char.ToLower(s[i]); } if ((s[i] == '-')) { newString = newString + s[i]; newString = newString + char.ToUpper(s[i + 1]); i++; } if (char.IsDigit(s[i])) { newString = newString + s[i]; newString = newString + char.ToUpper(s[i + 1]); i++; } if (char.IsWhiteSpace(s[i])) { newString = newString + s[i]; newString = newString + char.ToUpper(s[i + 1]); i++; } } } catch (IndexOutOfRangeException e) { /*MessageBox.Show(e.Message);*/ } return(newString); }
private void LoadFees() { ArrayList ClassArray = new ArrayList(); ArrayList FeeArrayList = new ArrayList(); ArrayList TutionFeeArray = new ArrayList(); ArrayList ExamFeeArray = new ArrayList(); var clas = db.Randoms.Where(c => c.ID == 26).FirstOrDefault(); var clasarray = clas.Text.Split(','); ClassArray.AddRange(clasarray); var fee = db.Randoms.Where(c => c.ID == 32).FirstOrDefault(); var feearray = fee.Text.ToString().Split(';'); FeeArrayList.AddRange(feearray); for (int i = 0; i <= FeeArrayList.ToArray().Length - 1; i++) { var narray = FeeArrayList[i].ToString().Split(','); TutionFeeArray.Add(narray[0].ToString()); ExamFeeArray.Add(narray[1].ToString()); } for (int j = 0; j <= ClassArray.ToArray().Length - 1; j++) { string className = "txtclass" + (j + 1).ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(className, true).FirstOrDefault() as BunifuMetroTextbox; lbl_text.Text = ClassArray[j].ToString(); string tfeeName = "tfee" + (j + 1).ToString(); BunifuMetroTextbox tfee_txt = this.Controls.Find(tfeeName, true).FirstOrDefault() as BunifuMetroTextbox; tfee_txt.Text = TutionFeeArray[j].ToString(); string efeeName = "efee" + (j + 1).ToString(); BunifuMetroTextbox efee_txt = this.Controls.Find(efeeName, true).FirstOrDefault() as BunifuMetroTextbox; efee_txt.Text = ExamFeeArray[j].ToString(); } }
private void txtTitle_OnValueChanged(object sender, EventArgs e) { if (temp_name == txtTitle.Text.Trim()) { lblerror1.Visible = false; } else if (DBAccess.find("sp_check_specialization", txtTitle.Text)) { lblerror1.Visible = true; } else { lblerror1.Visible = false; } BunifuMetroTextbox txt = (BunifuMetroTextbox)sender; Functions.noSpace(txt); }
/// <summary> /// Crear BuniFuTextBox use este metodo para crear campos dinamicos /// </summary> /// <param name="controls">Control padre al que se agregara los elementos </param> /// <param name="x">posicion en el eje X</param> /// <param name="y">posicion en el eje Y</param> /// <param name="labelValue">titulo del campo</param> /// <param name="textBoxValue">valor del campo</param> /// <param name="key">Clave para identificar el elemento</param> /// <param name="whidt">ancho del elemento</param> /// <param name="height">alto del elemento</param> /// <param name="gap">separacion de los elementos</param> private void createElement(Control.ControlCollection controls, int x, int y, string labelValue, string textBoxValue, string key = "", int whidt = 300, int height = 40, int gap = 10) { Label titlefield = new Label() { AutoSize = true, BackColor = System.Drawing.Color.White, Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), ForeColor = System.Drawing.Color.DimGray, Location = new System.Drawing.Point(x + 3, y + 3), Margin = new System.Windows.Forms.Padding(2, 0, 2, 0), Name = "label1111", Size = new System.Drawing.Size(59, 14), TabIndex = 8, Text = labelValue }; BunifuMetroTextbox textBoxBF1 = new BunifuMetroTextbox() { BackColor = System.Drawing.Color.White, BorderColorFocused = System.Drawing.Color.DodgerBlue, BorderColorIdle = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(157)))), ((int)(((byte)(157))))), BorderColorMouseHover = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(157)))), ((int)(((byte)(157))))), BorderThickness = 1, Cursor = System.Windows.Forms.Cursors.IBeam, Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))), isPassword = false, Location = new System.Drawing.Point(x, y), Margin = new System.Windows.Forms.Padding(4), Name = key, Padding = new System.Windows.Forms.Padding(2, 18, 5, 2), Size = new System.Drawing.Size(whidt, height), TabIndex = 9, TextAlign = System.Windows.Forms.HorizontalAlignment.Left, Text = textBoxValue }; textBoxBF1.OnValueChanged += new EventHandler(this.textMoneda1_OnValueChanged); textBoxBF1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textMoneda1_KeyPress); controls.Add(titlefield); controls.Add(textBoxBF1); }
private void personel_Click(object sender, EventArgs e) { BunifuMetroTextbox p_tarih = new BunifuMetroTextbox(); BunifuMetroTextbox[] text = { bmt_adi, bmt_adres, bmt_eposta, bmt_tckimlik, bmt_telefon, p_tarih }; BunifuFlatButton gelen = (BunifuFlatButton)sender; string[] id = gelen.Name.Split('_');// '_' göre metni parcalar int p_id = Convert.ToInt32(id[1]); veritabanı.id_personel_getir(text, p_id); for (int i = 0; i < text.Length - 1; i++) { text[i].Enabled = false; } btn_personelekle.Text = "Kilidi Kaldır"; TimeSpan gun = new TimeSpan(2010, 10, 10); bdp_dogumtarihi.Value = DateTime.Parse(p_tarih.Text); lb_aciklama.Text = "Tekrar personel ekleyebilmek için lütfen 'Kilidi Kaldır' butonuna tıklayınız."; }
/// <summary> /// Colorear BunifuMetroTextbox /// </summary> /// <param name="textBox">BunifuMetroTextbox</param> /// <param name="type"> 0 = error | 1 = success | 2 = warning | 3 = info | 4 = purple </param> internal static void textboxValidateColor(BunifuMetroTextbox textBox, int type = 1) { switch (type) { case 0: /// error textBox.BorderColorIdle = Color.FromArgb(248, 63, 81); textBox.BorderColorFocused = Color.FromArgb(248, 63, 81); textBox.BorderColorMouseHover = Color.FromArgb(248, 63, 81); break; case 1: /// success textBox.BorderColorIdle = Color.FromArgb(23, 203, 34); textBox.BorderColorFocused = Color.FromArgb(23, 203, 34); textBox.BorderColorMouseHover = Color.FromArgb(23, 203, 34); break; case 2: /// warning textBox.BorderColorIdle = Color.FromArgb(255, 202, 40); textBox.BorderColorFocused = Color.FromArgb(255, 202, 40); textBox.BorderColorMouseHover = Color.FromArgb(255, 202, 40); break; case 3: /// info textBox.BorderColorIdle = Color.FromArgb(24, 156, 225); textBox.BorderColorFocused = Color.FromArgb(24, 156, 225); textBox.BorderColorMouseHover = Color.FromArgb(24, 156, 225); break; case 4: /// purple textBox.BorderColorIdle = Color.FromArgb(255, 20, 198); textBox.BorderColorFocused = Color.FromArgb(255, 20, 198); textBox.BorderColorMouseHover = Color.FromArgb(255, 20, 198); break; default: break; } }
private void btnsavesection_Click(object sender, EventArgs e) { ArrayList seclist = new ArrayList(); for (int i = 0; i <= 15; i++) { string secname = "txtsec" + (i + 1).ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(secname, true).FirstOrDefault() as BunifuMetroTextbox; if (lbl_text.Text != "") { seclist.Add(lbl_text.Text); } } string classess = String.Join(",", seclist.ToArray()); try { var sec = db.Randoms.Where(c => c.ID == 27).FirstOrDefault(); sec.Text = classess.ToString(); db.Entry(sec).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } catch (Exception ex) { labelresult.Text = ex.Message.ToString(); labelresult.Visible = true; labelresult.ForeColor = Color.Red; } finally { labelresult.Text = "*Succesfully Saved!"; labelresult.Visible = true; labelresult.ForeColor = Color.Green; } }
public void TabIndexing() { for (int i = 1; i <= 16; i++) { string secname = "txtclass" + (i).ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(secname, true).FirstOrDefault() as BunifuMetroTextbox; lbl_text.TabIndex = i; } SfButton btn = this.Controls.Find("btnsaveclass", true).FirstOrDefault() as SfButton; btn.TabIndex = 17; for (int i = 1; i <= 16; i++) { string secname = "txtsec" + (i).ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(secname, true).FirstOrDefault() as BunifuMetroTextbox; lbl_text.TabIndex = (i + 1) + 16; } SfButton btn1 = this.Controls.Find("btnsavesection", true).FirstOrDefault() as SfButton; btn1.TabIndex = 34; }
public void LoadClassess() { var clas = db.Randoms.Where(c => c.ID == 26).FirstOrDefault(); var clasarr = clas.Text.Split(','); ArrayList ClassArray = new ArrayList(); ClassArray.AddRange(clasarr); for (int i = 1; i <= ClassArray.ToArray().Length; i++) { string className = "txtclass" + i.ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(className, true).FirstOrDefault() as BunifuMetroTextbox; lbl_text.Enabled = false; } for (int j = 0; j <= ClassArray.ToArray().Length - 1; j++) { string className = "txtclass" + (j + 1).ToString(); BunifuMetroTextbox lbl_text = this.Controls.Find(className, true).FirstOrDefault() as BunifuMetroTextbox; lbl_text.Text = ClassArray[j].ToString(); } }