private void ena_object(bool ena) { CurrencyManager cm = (CurrencyManager)BindingContext[dataGrid1.DataSource, dataGrid1.DataMember]; DataView dv = (DataView)cm.List; dv.AllowNew = false; cb_quandoan.Enabled = ena; cb_sudoan.Enabled = ena; //khuyen 12/02/2014 do them 2 combobox tren form cmbTrung_Doan.Enabled = ena; cmbTieu_doan.Enabled = ena; txttieudoan.Enabled = ena; //end cmbCapBac.Enabled = ena; cmbChucVu.Enabled = ena; butMoi.Enabled = !ena; butSua.Enabled = !ena; butHuy.Enabled = !ena; butKetthuc.Enabled = !ena; butLuu.Enabled = ena; butBoqua.Enabled = ena; if (!ena) { butMoi.Focus(); } }
private void butLuu_Click(object sender, System.EventArgs e) { try { if (ds.HasChanges()) { Tongcong(); } if (ds.HasChanges()) { m.execute_data("delete from " + m.user + ".khbieu_13 where id=" + l_id); string exp = "soluong>0"; DataRow[] r = ds.Tables[0].Select(exp); Int16 iRec = Convert.ToInt16(r.Length); for (Int16 i = 0; i < iRec; i++) { m.upd_kh13(l_id, int.Parse(r[i]["ma"].ToString()), ngay.Text, int.Parse(r[i]["soluong"].ToString()), r[i]["ghichu"].ToString(), i_userid); } } ena_object(false); decimal id = l_id; load_ngay(); cmbNgay.SelectedValue = id.ToString(); l_id = id; } catch {} load_grid(false); butMoi.Focus(); }
private void butLuu_Click(object sender, System.EventArgs e) { try { if (ds.HasChanges()) { tongcong(); } if (ds.HasChanges()) { m.execute_data("delete from khbieu_01 where id=" + l_id); string exp = "c01+c02+c03+c04+c05+c06+c07+c08+c09+c10+c11+c12+c13+c14+c15+c16>0"; DataRow[] r = ds.Tables[0].Select(exp); Int16 iRec = Convert.ToInt16(r.Length); for (int i = 0; i < iRec; i++) { m.upd_kh01(l_id, r[i]["ma"].ToString(), ngay.Text, int.Parse(r[i]["C01"].ToString()), int.Parse(r[i]["C02"].ToString()), int.Parse(r[i]["C03"].ToString()), int.Parse(r[i]["C04"].ToString()), int.Parse(r[i]["C05"].ToString()), int.Parse(r[i]["C06"].ToString()), int.Parse(r[i]["C07"].ToString()), int.Parse(r[i]["C08"].ToString()), int.Parse(r[i]["C09"].ToString()), int.Parse(r[i]["C10"].ToString()), int.Parse(r[i]["C11"].ToString()), int.Parse(r[i]["C12"].ToString()), int.Parse(r[i]["C13"].ToString()), int.Parse(r[i]["C14"].ToString()), int.Parse(r[i]["C15"].ToString()), int.Parse(r[i]["C16"].ToString()), i_userid); } } ena_object(false); long id = l_id; load_ngay(); cmbNgay.SelectedValue = id.ToString(); l_id = id; } catch {} load_grid(false); butMoi.Focus(); }
private void butLuu_Click(object sender, System.EventArgs e) { try { if (ds.HasChanges()) { tongcong(); } if (ds.HasChanges()) { m.execute_data("delete from khbieu_032 where id=" + l_id); string exp = "c01+c02+c03+c04+c05 >0"; DataRow[] dr = ds.Tables[0].Select(exp); Int16 cRec = Convert.ToInt16(dr.Length); for (int j = 0; j < cRec; j++) { m.upd_kh032(l_id, dr[j]["ma"].ToString(), ngay.Text, int.Parse(dr[j]["C01"].ToString()), int.Parse(dr[j]["C02"].ToString()), int.Parse(dr[j]["C03"].ToString()), int.Parse(dr[j]["C04"].ToString()), int.Parse(dr[j]["C05"].ToString()), i_userid); } } ena_object(false); decimal id = l_id; load_ngay(); cmbNgay.SelectedValue = id.ToString(); l_id = id; } catch {} load_grid(false); butMoi.Focus(); }
private void butLuu_Click(object sender, System.EventArgs e) { try { if (ds.HasChanges()) { Tongcong(); } if (ds.HasChanges()) { m.execute_data("delete from " + m.user + ".bieu_1021 where id=" + l_id); string exp = "vienphi+bhyt>0"; DataRow[] r = ds.Tables[0].Select(exp); Int16 iRec = Convert.ToInt16(r.Length); for (Int16 i = 0; i < iRec; i++) { m.upd_bieu1021(l_id, int.Parse(r[i]["ma"].ToString()), ngay.Text, Decimal.Parse(r[i]["vienphi"].ToString()), Decimal.Parse(r[i]["bhyt"].ToString()), i_userid); } } ena_object(false); long id = l_id; load_ngay(); cmbNgay.SelectedValue = id.ToString(); l_id = id; } catch {} butMoi.Focus(); }
private void cmbpkt_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { cmdLUU.Focus(); } }
private void m_txtPesoLiquidoTotal_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.Enter) { if (m_lvEmbalagens.SelectedItems.Count > 0) { int nIndex = m_lvEmbalagens.Items.IndexOf(m_lvEmbalagens.SelectedItems[0]); if (nIndex < (m_lvEmbalagens.Items.Count - 1)) { System.Windows.Forms.ListViewItem lviEmbalagem = m_lvEmbalagens.Items[(nIndex + 1)]; lviEmbalagem.Selected = true; m_txtQuantidade.Focus(); } else { m_lvEmbalagens.Items[0].Selected = true; m_btOk.Focus(); } } else { m_btOk.Focus(); } } }
private void butLuu_Click(object sender, System.EventArgs e) { try { if (ds.HasChanges()) { m.execute_data("delete from " + m.user + ".bieu_08 where id=" + l_id); string exp = "c01+c02+c03+c04+c05+c06+c07>0"; DataRow[] r = ds.Tables[0].Select(exp); Int16 iRec = Convert.ToInt16(r.Length); for (Int16 i = 0; i < iRec; i++) { m.upd_bieu08(l_id, int.Parse(r[i]["ma"].ToString()), ngay.Text, int.Parse(r[i]["c01"].ToString()), int.Parse(r[i]["c02"].ToString()), int.Parse(r[i]["c03"].ToString()), int.Parse(r[i]["c04"].ToString()), int.Parse(r[i]["c05"].ToString()), int.Parse(r[i]["c06"].ToString()), int.Parse(r[i]["c07"].ToString()), i_userid); } } ena_object(false); long id = l_id; load_ngay(); cmbNgay.SelectedValue = id.ToString(); l_id = id; } catch {} load_grid(false); butMoi.Focus(); }
private void Feedback(object sender, SendingReportFeedbackEventArgs e) { switch (e.Step) { case SendingReportStep.PreparingReport: if (e.Failed) { preparingFeedback.Stop(e.ErrorMessage); retrySending.Visible = true; retrySending.Focus(); buttonSaveAsFile.Visible = true; } else { preparingFeedback.Start(); } break; case SendingReportStep.ConnectingToServer: if (e.Failed) { connectingFeedback.Stop(e.ErrorMessage); retrySending.Visible = true; retrySending.Focus(); buttonSaveAsFile.Visible = true; } else { preparingFeedback.Stop(); connectingFeedback.Start(); } break; case SendingReportStep.Transfering: if (e.Failed) { waitSendingReport.Visible = false; transferingFeedback.Stop(e.ErrorMessage); retrySending.Visible = true; retrySending.Focus(); buttonSaveAsFile.Visible = true; } else { connectingFeedback.Stop(); transferingFeedback.Start(); waitSendingReport.Visible = true; } break; case SendingReportStep.Finished: waitSendingReport.Visible = false; transferingFeedback.Stop(); completedFeedback.Stop(); ok.Enabled = true; ok.Focus(); cancelSending.Enabled = false; break; } }
private void btnSaveOleDb_Click(object sender, System.EventArgs e) { if (saveOleDbFileDialog.ShowDialog() == DialogResult.OK) { FileUtil.WriteToFile(saveOleDbFileDialog.FileName, dsSettings.settings[0].OleDbConnect); } btnConnect.Focus(); }
private void DIADIEMKHAM_Load(object sender, System.EventArgs e) { Ena_button(false); txtMADD.Enabled = false; txtTENDD.Enabled = false; Load_Grid(); Load_cmbThuoc(); Text_First(); cmdThem.Focus(); }
private void butLuu_Click(object sender, System.EventArgs e) { if (!kiemtra()) { return; } m.upd_ba_tiensusk(m_ngay, m_id, stt.Value, nam.Text, (du.Checked)?1:(thieu.Checked)?2:0, (say.Checked)?0:(hut.Checked)?1:(nao.Checked)?2:3, (covac.Checked)?1:0, (ngoai.Checked)?0:1, (chet.Checked)?0:1, (cannang.Text != "")?decimal.Parse(cannang.Text):0, int.Parse(cachthucde.SelectedValue.ToString()), (taibien.Checked)?1:0); load_grid(); ena_object(false); butThem.Focus(); }
private void chkCosolieu_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { butKetchuyen.Focus(); } } catch { } }
private void butLuu_Click(object sender, System.EventArgs e) { Cursor = Cursors.WaitCursor; dsxml.AcceptChanges(); foreach (DataRow r in dsxml.Tables[0].Rows) { ttb.upd_dutrukho(i_manguon, i_makho, s_mmyy, int.Parse(r["mabd"].ToString()), decimal.Parse(r["dau"].ToString()), decimal.Parse(r["nhap"].ToString()), decimal.Parse(r["xuat"].ToString()), decimal.Parse(r["ton"].ToString()), decimal.Parse(r["tutruc"].ToString()), decimal.Parse(r["tc"].ToString()), decimal.Parse(r["dongia"].ToString()), decimal.Parse(r["l1"].ToString()), decimal.Parse(r["d1"].ToString()), decimal.Parse(r["l2"].ToString()), decimal.Parse(r["d2"].ToString()), r["nhacc"].ToString(), r["donvi"].ToString(), i_lanthu); } Cursor = Cursors.Default; butIn.Focus(); }
private void chk_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (chk.Checked) { cmdLuu.Focus(); } else { msk1.Focus(); } } }
private void butLuu_Click(object sender, System.EventArgs e) { try { if (ds.HasChanges()) { Tongcong(); } if (ds.HasChanges()) { m.execute_data("delete from " + m.user + ".kh_bieu_141 where id=" + l_id); string exp = "c01+c02+c03+c04+c05+c06+c07+c08+c09+c10+c11+c12+c13+c14+c15+c16+c17+c18+c19+c20+c21+c22+c23+c24+c25+c26+c27+c28>0"; DataRow[] r = ds.Tables[0].Select(exp); Int16 iRec = Convert.ToInt16(r.Length); for (Int16 i = 0; i < iRec; i++) { //ThanhCuong 25/02/2012 m.upd_kh141(l_id, int.Parse(r[i]["ma"].ToString()), ngay.Text, int.Parse(r[i]["c01"].ToString()), int.Parse(r[i]["c02"].ToString()), int.Parse(r[i]["c03"].ToString()), int.Parse(r[i]["c04"].ToString()), int.Parse(r[i]["c05"].ToString()), int.Parse(r[i]["c06"].ToString()), int.Parse(r[i]["c07"].ToString()), int.Parse(r[i]["c08"].ToString()), int.Parse(r[i]["c09"].ToString()), int.Parse(r[i]["c10"].ToString()), int.Parse(r[i]["c11"].ToString()), int.Parse(r[i]["c12"].ToString()), int.Parse(r[i]["c13"].ToString()), int.Parse(r[i]["c14"].ToString()), int.Parse(r[i]["c15"].ToString()), int.Parse(r[i]["c16"].ToString()), int.Parse(r[i]["c17"].ToString()), int.Parse(r[i]["c18"].ToString()), int.Parse(r[i]["c19"].ToString()), int.Parse(r[i]["c20"].ToString()), int.Parse(r[i]["c21"].ToString()), int.Parse(r[i]["c22"].ToString()), int.Parse(r[i]["c23"].ToString()), int.Parse(r[i]["c24"].ToString()), int.Parse(r[i]["c25"].ToString()), int.Parse(r[i]["c26"].ToString()), int.Parse(r[i]["c27"].ToString()), int.Parse(r[i]["c28"].ToString()), i_userid, int.Parse(r[i]["c29"].ToString()), int.Parse(r[i]["c30"].ToString()), int.Parse(r[i]["c31"].ToString()), int.Parse(r[i]["c32"].ToString()), int.Parse(r[i]["c33"].ToString()), int.Parse(r[i]["c34"].ToString()), int.Parse(r[i]["c35"].ToString()), int.Parse(r[i]["c36"].ToString()), int.Parse(r[i]["c37"].ToString()), int.Parse(r[i]["c38"].ToString()), int.Parse(r[i]["c39"].ToString()), int.Parse(r[i]["c40"].ToString()), int.Parse(r[i]["c41"].ToString()), int.Parse(r[i]["c42"].ToString()), int.Parse(r[i]["c43"].ToString()), int.Parse(r[i]["c44"].ToString()), int.Parse(r[i]["c45"].ToString()), int.Parse(r[i]["c46"].ToString()), int.Parse(r[i]["c47"].ToString()), int.Parse(r[i]["c48"].ToString()), int.Parse(r[i]["c49"].ToString()), int.Parse(r[i]["c50"].ToString()), int.Parse(r[i]["c51"].ToString()), int.Parse(r[i]["c52"].ToString()), int.Parse(r[i]["c53"].ToString()), int.Parse(r[i]["c54"].ToString()), int.Parse(r[i]["c55"].ToString()), int.Parse(r[i]["c56"].ToString())); // } } ena_object(false); decimal id = l_id; load_ngay(); cmbNgay.SelectedValue = id.ToString(); l_id = id; } catch {} load_grid(false); butMoi.Focus(); }
private void butLuu_Click(object sender, System.EventArgs e) { try { if (ds.HasChanges()) { Tongcong(); } if (ds.HasChanges()) { m.execute_data("delete from kh_bieu_1451 where id=" + l_id); string exp = "c01+c02+c03+c04+c05+c06+c07+c08+c09+c10+c11+c12+c13+c14+c15+c16+c17+c17+c19+c20>0"; DataRow[] r = ds.Tables[0].Select(exp); Int16 iRec = Convert.ToInt16(r.Length); for (Int16 i = 0; i < iRec; i++) { m.upd_kh1451(l_id, int.Parse(r[i]["ma"].ToString()), ngay.Text, int.Parse(r[i]["c01"].ToString()), int.Parse(r[i]["c02"].ToString()), int.Parse(r[i]["c03"].ToString()), int.Parse(r[i]["c04"].ToString()), int.Parse(r[i]["c05"].ToString()), int.Parse(r[i]["c06"].ToString()), int.Parse(r[i]["c07"].ToString()), int.Parse(r[i]["c08"].ToString()), int.Parse(r[i]["c09"].ToString()), int.Parse(r[i]["c10"].ToString()), int.Parse(r[i]["c11"].ToString()), int.Parse(r[i]["c12"].ToString()), int.Parse(r[i]["c13"].ToString()), int.Parse(r[i]["c14"].ToString()), int.Parse(r[i]["c15"].ToString()), int.Parse(r[i]["c16"].ToString()), int.Parse(r[i]["c17"].ToString()), int.Parse(r[i]["c18"].ToString()), int.Parse(r[i]["c19"].ToString()), int.Parse(r[i]["c20"].ToString()), i_userid); } } if (ds1.HasChanges()) { m.execute_data("delete from kh_bieu_1452 where id=" + l_id); string exp1 = "c01+c02+c03>0"; DataRow[] r1 = ds1.Tables[0].Select(exp1); Int16 iRec1 = Convert.ToInt16(r1.Length); for (Int16 i = 0; i < iRec1; i++) { m.upd_kh1452(l_id, int.Parse(r1[i]["ma"].ToString()), ngay.Text, int.Parse(r1[i]["c01"].ToString()), int.Parse(r1[i]["c02"].ToString()), int.Parse(r1[i]["c03"].ToString()), i_userid); } } ena_object(false); decimal id = l_id; load_ngay(); cmbNgay.SelectedValue = id.ToString(); l_id = id; } catch {} load_grid(false); load_grid1(false); butMoi.Focus(); }
private void luu_Click(object sender, System.EventArgs e) { int i; if (manhom.TextLength == 0) { MessageBox.Show("Nhập mã nhóm", "Thông Báo"); manhom.Focus(); return; } if (tennhom.TextLength == 0) { MessageBox.Show("Nhập tên nhóm", "Thông Báo"); tennhom.Focus(); return; } try { i = int.Parse(manhom.Text.ToString()); } catch { MessageBox.Show("Nhập mã nhóm bằng ký tự số", "Thông Báo"); manhom.Focus(); return; } k.ins_nhomphong(i, tennhom.Text.ToString()); Load_data(); EnaBut(false); EnaText(false); them.Focus(); }
private void ena_object(bool ena) { CurrencyManager cm = (CurrencyManager)BindingContext[dataGrid1.DataSource, dataGrid1.DataMember]; DataView dv = (DataView)cm.List; dv.AllowNew = false; madoituong.Enabled = ena; ten.Enabled = ena; soluong.Enabled = ena; butMoi.Enabled = !ena; butSua.Enabled = !ena; butHuy.Enabled = !ena; butKetthuc.Enabled = !ena; butLietke.Enabled = !ena; butLuu.Enabled = ena; butBoqua.Enabled = ena; //dataGrid1.ReadOnly=!ena; if (ena && l_id == 0) { ten.Text = ""; soluong.Text = "1"; s_dvt = ""; i_paid = 0; i_done = 0; } else { butMoi.Focus(); } }
private void butLuu_Click(object sender, System.EventArgs e) { if (!kiemtra()) { return; } if (i_id == 0) { i_id = f_get_id_chinhanh();//binh 01062011 } if (!m.upd_dmchinhanh(i_id, txtten.Text, txtdatabaselink.Text.Trim(), txtip.Text, txtviettat.Text, (chkserver.Checked) ? 1 : 0, mabv.Text.Trim(), txtPort.Text, txtDatabase.Text)) { MessageBox.Show(lan.Change_language_MessageText("Không cập nhật thông tin !")); return; } //linh m.execute_data("drop database link " + txtdatabaselink.Text.Trim()); m.execute_data("CREATE PUBLIC DATABASE LINK " + txtdatabaselink.Text.Trim() + " CONNECT TO " + m.User_database + " IDENTIFIED BY '" + m.Password_database + "' USING libpq 'host=" + txtip.Text.Trim() + " port=" + txtPort.Text + " dbname=" + txtDatabase.Text + "';"); //end linh load_grid(); ena_form(false); ena_object(false); try { butMoi.Focus(); } catch {} }
private void cmdLUU_Click(object sender, System.EventArgs e) { if (!Kiemtra()) { return; } string gbdlamviec; string gktlamviec; try { gbdlamviec = cmbgbd.Text.Substring(0, 2).ToString().Trim() + ":" + cmbpbd.Text.Substring(0, 2).ToString().Trim(); gktlamviec = cmbgkt.Text.Substring(0, 2).ToString().Trim() + ":" + cmbpkt.Text.Substring(0, 2).ToString().Trim(); } catch { MessageBox.Show("Chọn giờ từ danh sách sổ xuống", "Thông Báo"); return; } MessageBox.Show("Từ " + gbdlamviec + " Đến " + gktlamviec, "Giờ làm việc"); k.Del_thoigian(lb1.Text.ToString().Trim()); k.Ins_Thoigian(gbdlamviec, gktlamviec); WriteXML(); Write_XML(); Ena_Textbox(true); Load_TG(); grb1.Visible = true; grb2.Visible = false; cmdKetthuc.Enabled = true; cmdSua.Enabled = true; cmdLUU.Enabled = false; cmdKetthuc.Focus(); upd++; }
private void sothe_Validated(object sender, System.EventArgs e) { if (sothe.Text == "") { butXem.Focus(); } }
private bool kiemtra() { if (mabs.Text == "") { mabs.Focus(); return(false); } if (ma.Text == "") { ma.Focus(); return(false); } if (ghichu.Text == "") { MessageBox.Show(lan.Change_language_MessageText("Nhập diễm giải !"), LibMedi.AccessData.Msg); ghichu.Focus(); return(false); } if (dt.Rows.Count == 0) { butThem.Focus(); return(false); } return(true); }
private void tim_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab) { butIn.Focus(); } }
private void cmbRatings_SelectedIndexChanged(object sender, System.EventArgs e) { if (cmbRatings.SelectedItem.ToString().Length > 0) { btnRate.Focus(); } }
/* * // private void cmbSS_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) * // { * // if(e.KeyValue==13) * // { * // cmbSS.DroppedDown=false; * // if(isTab==true) * // { * // isTab=false; * // SendKeys.Send("{tab}"); * // } * // else isTab=true; * // } * // else isTab=false; * // } * // * // private void cmbSS_TextChanged(object sender, System.EventArgs e) * // { * // if(isDown) return; * // try * // { * // if(cmbSS.Text.Trim()=="")return; * // DataRow[] dr=myTb.Select("py_code like '"+cmbSS.Text.Trim()+"%'","py_code"); * // cmbSS.Items.Clear(); * // for(int j=0;j<dr.Length;j++) * // { * // cmbSS.Items.Add(dr[j]["NAME"]); * // } * // if( cmbSS.Items.Count>0 ) * // { * // cmbSS.SelectionStart=cmbSS.Text.Length; * // cmbSS.DroppedDown=true; * // } * // else * // { * // cmbSS.Select(cmbSS.Text.Trim().Length-1,1); * // cmbSS.DroppedDown=false; * // } * // * // } * // catch(System.Exception err) * // { * // err.ToString(); * // } * // } * // * // private void cmbSS_SelectionChangeCommitted(object sender, System.EventArgs e) * // { * //// SendKeys.Send("{tab}"); * // * // } * // public void ComboBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) * // { * // ComboBox cmb=(ComboBox)sender; * // int iSelectRow=-1; * // if(e.KeyValue>=32 && e.KeyValue<=127) * // { * // string strSelect=cmb.Text.Trim(); * // if(strSelect=="")return; * // iSelectRow=cmb.FindString(strSelect); * // if(iSelectRow>=0) * // { * // cmb.SelectionStart=strSelect.Length; * // cmb.SelectionLength=cmb.Text.Length-strSelect.Length; * // cmb.DroppedDown=true; * // } * // } * // if(e.KeyValue==13 && iSelectRow>=0) * // { * // cmb.SelectedIndex=iSelectRow; * // cmb.DroppedDown=false; * // } * // } * // * // private void cmbSS_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) * // { * // if(e.KeyData==Keys.Down || e.KeyData==Keys.Up) isDown=true; * // else isDown=false; * // * // } */ private void ComboBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { cmb = (ComboBox)sender; bool respondKey = true; DataRow dr = null; if (cmb.Name == "cmbExplain") { dr = WorkStaticFun.GetCardData(cmb, e.KeyValue, 1, dGrid_Sel, 0, ds, "explain", FilterType.智能, SearchType.前导相似, ref respondKey, "", false); } else { dr = WorkStaticFun.GetCardData(cmb, e.KeyValue, 1, dGrid_Sel, 1, ds, "ss", FilterType.智能, SearchType.前导相似, ref respondKey, "", false); } if (dr != null && respondKey) { if (gBoxExplain.Enabled == true) { default_usage = dr["CODE"].ToString().Trim(); } cmb.Text = dr["name"].ToString().Trim(); } if (e.KeyValue == 13) { btOK.Focus(); } }
private void nazwa_t_LostFocus(object sender, System.EventArgs e) { if (button1.Focus() != true) { inputPanel1.Enabled = false; } }
private void mabn_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { butDuyet.Focus(); } }
private void txtNewPass2_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (Strings.Asc(e.KeyChar) == 13) { cmdNew.Focus(); } }
private void _backButton_Click(object sender, System.EventArgs e) { LeaveCurrentPane(PaneChangeReason.BackPressed); --_currentIndex; EnterCurrentPane(PaneChangeReason.BackPressed); _backButton.Focus(); }
public static void RemoveFocus(Control ctrl) { Button btn = new Button(); btn.Parent = ctrl; btn.Left = -9999; btn.Top = -9999; btn.Focus(); btn.Dispose(); }
public TimeToggleButton() { start = (Button)FindControlByName("startTimeButton"); stop = (Button)FindControlByName("stopTimeButton"); start.Click += start_Click; stop.Click += stop_Click; OperateOnControl(stop, _ => { stop.Width = start.Width = (stop.Left + stop.Width) - start.Left; stop.Left = start.Left; stop.Hide(); start.Focus(); }); }
private void InitializeComponent() { Text = "Error"; okButton = new System.Windows.Forms.Button(); cancelButton = new System.Windows.Forms.Button(); detailsButton = new System.Windows.Forms.Button(); pictureBox = new System.Windows.Forms.PictureBox(); errorLabel = new System.Windows.Forms.Label(); errorMessageLabel = new System.Windows.Forms.Label(); SuspendLayout(); // // okButton // okButton.FlatStyle = System.Windows.Forms.FlatStyle.System; okButton.Location = new System.Drawing.Point(160, 100); okButton.Name = "okButton"; okButton.TabIndex = 0; okButton.Text = "OK"; okButton.Click += new EventHandler(okButton_Click); AcceptButton = okButton; // // cancelButton // cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System; cancelButton.Location = new System.Drawing.Point(240, 100); cancelButton.Name = "cancelButton"; cancelButton.TabIndex = 1; cancelButton.Text = "Cancel"; CancelButton = cancelButton; // // detailsButton // detailsButton.FlatStyle = System.Windows.Forms.FlatStyle.System; detailsButton.Location = new System.Drawing.Point(320, 100); detailsButton.Name = "detailsButton"; detailsButton.TabIndex = 2; detailsButton.Text = "Details"; detailsButton.Click += new EventHandler(detailsButton_Click); // // pictureBox // pictureBox.Location = new System.Drawing.Point(11, 11); pictureBox.Name = "pictureBox"; pictureBox.Size = new System.Drawing.Size(40, 40); pictureBox.TabIndex = 3; pictureBox.TabStop = false; Bitmap errorImage = new Bitmap(WixFiles.GetResourceStream("error.png")); errorImage.MakeTransparent(); pictureBox.Image = errorImage; // // errorLabel // errorLabel.Location = new System.Drawing.Point(64, 20); errorLabel.Name = "errorLabel"; errorLabel.Size = new System.Drawing.Size(456, 40); errorLabel.TabIndex = 4; errorLabel.Text = message; // // errorLabel // errorMessageLabel.Location = new System.Drawing.Point(64, 60); errorMessageLabel.Name = "errorMessageLabel"; errorMessageLabel.Size = new System.Drawing.Size(456, 40); errorMessageLabel.TabIndex = 4; errorMessageLabel.Text = "Error message: " + exception.Message; // // ExceptionForm // AutoScaleBaseSize = new System.Drawing.Size(5, 13); ClientSize = new System.Drawing.Size(545, 134); Controls.Add(errorLabel); Controls.Add(errorMessageLabel); Controls.Add(pictureBox); Controls.Add(detailsButton); Controls.Add(cancelButton); Controls.Add(okButton); FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; MaximizeBox = false; MinimizeBox = false; Name = "ExceptionForm"; ShowInTaskbar = false; ResumeLayout(false); okButton.Focus(); CenterToScreen(); }
public void EnterLeaveEvents () { Form f = new Form (); TabControl tc = new TabControl (); TabPage p1 = new TabPage (); string events = string.Empty; tc.Enter += new EventHandler (delegate (Object obj, EventArgs e) { events += ("tc_OnEnter;"); }); tc.Leave += new EventHandler (delegate (Object obj, EventArgs e) { events += ("tc_OnLeave;"); }); p1.Enter += new EventHandler (delegate (Object obj, EventArgs e) { events += ("p1_OnEnter;");}); p1.Leave += new EventHandler (delegate (Object obj, EventArgs e) { events += ("p1_OnLeave;"); }); tc.TabPages.Add (p1); Button b1 = new Button (); tc.TabIndex = 0; b1.TabIndex = 1; f.Controls.Add (b1); f.Controls.Add (tc); f.Show (); Assert.AreEqual ("tc_OnEnter;p1_OnEnter;", events, "A1"); b1.Focus (); Assert.AreEqual ("tc_OnEnter;p1_OnEnter;p1_OnLeave;tc_OnLeave;", events, "A2"); }
private void EditQbtn(Button btn) { btn.Focus(); Color oriBgColor = btn.BackColor; Color oriForeColor = btn.ForeColor; btn.BackColor = SystemColors.Highlight; btn.ForeColor = SystemColors.HighlightText; int i = QbtnIndex(btn); frmQEditor UI = QEditorUI; UI.Left = this.Right - UI.Width; UI.Top = this.Bottom - UI.Height; UI.ClearAll(); UI.ReadFrom(Qs[i - 1]); if (UI.ShowDialog() == DialogResult.OK) { UI.WriteTo(ref Qs[i - 1]); Program.SaveSettings(); } RefreshQbtn(); btn.BackColor = oriBgColor; btn.ForeColor = oriForeColor; if (!Program.beClassic) btn.UseVisualStyleBackColor = true; }
public void RemoveFocus() { Button btn = new Button(); btn.Parent = this; btn.Left = -9999; btn.Top = -9999; btn.Focus(); btn.Dispose(); }
private void cmdLlenarLotesYPesos_Click(object sender, EventArgs e) { this.llenarPesos(); Button cmdCreartodas = new Button(); cmdCreartodas.Name = "cmdCrearTodas"; cmdCreartodas.Text = "&Paso 1: Pesos"; cmdCreartodas.Font = cmdLlenarPesos.Font; cmdCreartodas.Size = cmdLlenarPesos.Size; cmdCreartodas.Width -= 30; //cmdCreartodas.Location = new Point(cmdCopiarPesos.Location.X + cmdCopiarPesos.Width + 35, cmdCopiarPesos.Location.Y); cmdCreartodas.Click += new EventHandler(cmdCrearTodas_Click); cmdCreartodas.Focus(); cmdLlenarPesos.Visible = false; tableLayoutPanel.Controls.Add(cmdCreartodas, 3, 0); }
// User moved out of the West border. public void NewMap_West() { // Set new Coordinates. iCurrentX -= 1; iCurrentRoom += 725; // Clear Map Rooms. ClearRooms(); Button room = new Button(); string strRoomName = "room" + iCurrentRoom.ToString(); Control[] btnRoom = this.Controls.Find(strRoomName, true); if (btnRoom != null) { room = (Button)btnRoom[0]; room.Focus(); // If AutoMap is enabled, save the new room to the map. if (blnAutoMap) { room.BackColor = clrCurrent; // Save the Room Location SaveRoom(iCurrentArea, iCurrentRoom, iCurrentX, iCurrentY, iCurrentZ, HasUpLink(iCurrentRoom), HasDownLink(iCurrentRoom)); } } // Set Current Room Details. SetCurrentRoom(); // Update the Room Zoom View for the current room. UpdateZoomView(room); // Display the Current Map. DisplayPanelRooms(iCurrentArea, iCurrentX, iCurrentY, iCurrentZ); }
public void GetFocusTest () { using (Form f = new Form ()) { f.Show (); IRawElementProviderFragmentRoot provider = (IRawElementProviderFragmentRoot) ProviderFactory.GetProvider (f); Assert.IsNull (provider.GetFocus (), "Nothing is selected and GetFocus is returning something"); Button b1 = new Button (); b1.Location = new System.Drawing.Point (0, 0); f.Controls.Add (b1); Button b2 = new Button (); b2.Location = new System.Drawing.Point (50, 50); f.Controls.Add (b2); IRawElementProviderSimple button1Provider = ProviderFactory.GetProvider (b1); b1.Focus (); Assert.AreEqual (button1Provider, provider.GetFocus (), "GetFocus is not returning the first button"); IRawElementProviderSimple button2Provider = ProviderFactory.GetProvider (b2); b2.Focus (); Assert.AreEqual (button2Provider, provider.GetFocus (), "GetFocus is not returning the second button"); } }
// Move West on the Grid. void MoveWest() { // Set the Current Room indicator. DisplayCurrentRoom(false); string strRoomName = string.Empty; int iNextButton = iCurrentRoom - 25; bool blnRoomUpdated = false; bool blnLinkUpdated = false; // ## Move Room ## strRoomName = "room" + iNextButton; Button room = new Button(); Button hPath = new Button(); try { // Get the Room Control and set focus. Control[] btnRoom = this.Controls.Find(strRoomName, true); if (btnRoom != null) { room = (Button)btnRoom[0]; } room.Focus(); // If AutoMap is enabled, save the new room to the map. if (blnAutoMap) { if (room.BackColor != clrCurrent) { room.BackColor = clrCurrent; blnRoomUpdated = true; } // If AutoMap is enabled, link the respective rooms. Control[] btnHPath = this.Controls.Find("hpath" + iNextButton, true); if (btnHPath != null) { hPath = (Button)btnHPath[0]; if (!hPath.Visible) { hPath.Visible = true; blnLinkUpdated = true; } } } // Save the Room Location if (blnRoomUpdated || blnLinkUpdated) { SaveRoom(iCurrentArea, iCurrentRoom, iCurrentX, iCurrentY, iCurrentZ, HasUpLink(iCurrentRoom), HasDownLink(iCurrentRoom)); } // Set the room Details to the form. lblButtonName.Text = strRoomName.Replace("room", ""); iCurrentRoom = Convert.ToInt32(strRoomName.Replace("room", "")); SetCurrentRoom(); // Set new Current Room. iCurrentRoom = iNextButton; // Update the Room Zoom View for the current room. UpdateZoomView(room); } catch (Exception ex) { string strError = ex.Message; NewMap_West(); } // Set the Current Room indicator. DisplayCurrentRoom(true); }
// Shift Panel to the West. public void MovePanelWest() { // Set new Coordinates. iCurrentX -= 1; // Clear Map Rooms. ClearRooms(); // Get New Room Control. Button room = new Button(); string strRoomName = "room" + iCurrentRoom; Control[] btnRoom = this.Controls.Find(strRoomName, true); if (btnRoom != null) { room = (Button)btnRoom[0]; room.Focus(); } // Current Room Details. SetCurrentRoom(); // Update the Room Zoom View for the current room. UpdateZoomView(room); // Display the Current Map. DisplayPanelRooms(iCurrentArea, iCurrentX, iCurrentY, iCurrentZ); }
[Test] // bug #499887 public void SelectedIndexChangeFiresFocus () { Form f = new Form (); TabControl tc = new TabControl (); TabPage p1 = new TabPage (); TabPage p2 = new TabPage (); string events = string.Empty; tc.TabPages.Add (p1); tc.TabPages.Add (p2); tc.SelectedIndex = 0; Button b1 = new Button (); Button b2 = new Button (); f.Controls.Add (b1); f.Controls.Add (b2); f.Controls.Add (tc); f.Show (); b1.Focus (); b2.GotFocus += new EventHandler (delegate (Object obj, EventArgs e) { tc.SelectedIndex = 1; }); tc.GotFocus += new EventHandler(delegate (Object obj, EventArgs e) { events += ("tc_OnGotFocus" + tc.SelectedIndex + ";"); }); tc.SelectedIndexChanged += new EventHandler(delegate (Object obj, EventArgs e) { events += ("tc_OnSelectedIndexChanged" + tc.SelectedIndex + ";"); }); p2.Enter += new EventHandler(delegate (Object obj, EventArgs e) { events += ("p2_OnEnter" + tc.SelectedIndex + ";"); }); p2.Leave += new EventHandler (delegate (Object obj, EventArgs e) { events += ("p2_OnLeave;"); }); b2.Focus (); Assert.AreEqual ("tc_OnGotFocus0;p2_OnEnter1;tc_OnSelectedIndexChanged1;", events, "A1"); Assert.IsTrue (tc.Focused, "A2"); }
// Move Up to a new Grid. void MoveUp() { Button room = new Button(); string strRoomName = "room" + iCurrentRoom.ToString(); Control[] btnRoom = this.Controls.Find(strRoomName, true); if (btnRoom != null) { room = (Button)btnRoom[0]; room.Focus(); if (blnAutoMap) { // Save the Room Location SaveRoom(iCurrentArea, iCurrentRoom, iCurrentX, iCurrentY, iCurrentZ, true, HasDownLink(iCurrentRoom)); } } NewMap_Up(); }
public void GotFocusSelectedIndex () { TabControl tc = new TabControl (); tc.TabPages.Add ("A"); tc.TabPages.Add ("B"); Button b = new Button (); // Dummy button to receive focus by default Form f = new Form (); f.Controls.AddRange (new Control [] { b, tc }); f.Show (); tc.SelectedIndex = -1; // Make sure focus goes back to button b.Focus (); // Finally give focus back to TabControl tc.Focus (); Assert.AreEqual (-1, tc.SelectedIndex, "#A0"); }
private void InPhieuKham(string tenkhoa, Button button, string sokham, int isUuTien) { try { string val = "BỆNH NHÂN THƯỜNG"; if (_QMSProperties.MaKhoaKhamBenh == "KKB") { val = (isUuTien == 0) ? "BỆNH NHÂN THƯỜNG" : "BỆNH NHÂN ƯU TIÊN"; } Utility.WaitNow(this); UIAction._EnableControl(button, false, ""); DataTable dataTable = new DataTable(); Utility.AddColumToDataTable(ref dataTable, "So_Kham", typeof(string)); DataRow row = dataTable.NewRow(); row["So_Kham"] = Utility.sDbnull(sokham); dataTable.Rows.Add(row); CRPT_SOKHAM crpt_sokham = new CRPT_SOKHAM(); crpt_sokham.SetDataSource(dataTable); crpt_sokham.SetParameterValue("TEN_BENH_VIEN", _QMSProperties.TenBenhVien); string str2 = NgayIn(DateTime.Now); crpt_sokham.SetParameterValue("PrintDate", str2); crpt_sokham.SetParameterValue("TenKhoa", Utility.sDbnull(tenkhoa)); crpt_sokham.SetParameterValue("LoaiDoiTuong", val); if (!string.IsNullOrEmpty(_QMSProperties.PrinterName)) { crpt_sokham.PrintOptions.PrinterName = Utility.sDbnull(_QMSProperties.PrinterName); } crpt_sokham.PrintToPrinter(1, false, 0, 0); UIAction._EnableControl(button, true, ""); button.Focus(); } catch (Exception ex) { Utility.ShowMsg("Lỗi khi in số khám\n" + ex.Message); } finally { UIAction._EnableControl(cmdKhamYC, true,""); Utility.DefaultNow(this); } }
public void FocusTest () { Form f = null; Button c = null, d = null; try { f = new Form (); f.ShowInTaskbar = false; f.Visible = true; c = new Button (); c.Visible = true; f.Controls.Add (c); d = new Button (); d.Visible = false; f.Controls.Add (d); Assert.IsTrue (c.CanFocus, "Focus1"); Assert.IsFalse (c.Focused, "Focus2"); c.Focus (); Assert.IsTrue (c.Focused, "Focus3"); d.Focus (); Assert.IsFalse (d.Focused, "Focus4"); d.Visible = true; d.Focus (); Assert.IsTrue (d.Focused, "Focus5"); Assert.IsFalse (c.Focused, "Focus6"); c.Enabled = false; Assert.IsFalse (c.Focused, "Focus7"); } finally { if (f != null) f.Dispose (); if (c != null) c.Dispose (); if (d != null) d.Dispose (); } }
private void makeAddQuestionAndSave() { // Make a panel Panel addQuestionAndSavePanel = new Panel(); addQuestionAndSavePanel.BackColor = Color.Transparent; addQuestionAndSavePanel.Height = 150; addQuestionAndSavePanel.Width = Screen.PrimaryScreen.Bounds.Width - 225; addQuestionAndSavePanel.Name = "addQuestionAndSavePanel#" + panelCounter.ToString(); // Buttons are made here Button AddQuestionButton = new Button(); Button Save = new Button(); Button StartOver = new Button(); // Combox is made here ComboBox questionType = new ComboBox(); // Buttons settings AddQuestionButton.Location = new Point(470, 10); AddQuestionButton.Name = "AddQuestion#" + questionCounter.ToString(); AddQuestionButton.Size = new Size(160, 30); AddQuestionButton.TabIndex = questionCounter; AddQuestionButton.Text = "Vraag toevoegen"; AddQuestionButton.UseVisualStyleBackColor = true; AddQuestionButton.Focus(); AddQuestionButton.Font = new Font("Segoe Print", 10F, FontStyle.Regular, GraphicsUnit.Point); AddQuestionButton.Click += new EventHandler(AddQuestion_Click); StartOver.Location = new Point(755, 10); StartOver.Name = "StartOver#" + questionCounter.ToString(); StartOver.Size = new Size(160, 30); StartOver.TabIndex = questionCounter; StartOver.Text = "Overnieuw beginnen"; StartOver.UseVisualStyleBackColor = true; StartOver.Font = new Font("Segoe Print", 10F, FontStyle.Regular, GraphicsUnit.Point); StartOver.Click += new EventHandler(StartOver_Click); Save.Location = new Point(935,10); Save.Name = "Save#" + questionCounter.ToString(); Save.Size = new Size(90, 30); Save.TabIndex = questionCounter; Save.Text = "Opslaan"; Save.UseVisualStyleBackColor = true; Save.Font = new Font("Segoe Print", 10F, FontStyle.Regular, GraphicsUnit.Point); Save.Click += new EventHandler(Save_Click); // Combobox settings questionType.Location = new Point(300, 10); questionType.Name = "questionType#" + questionCounter.ToString(); questionType.Font = new Font("Segoe Print", 10F, FontStyle.Bold, GraphicsUnit.Point); questionType.DropDownStyle = ComboBoxStyle.DropDownList; questionType.Size = new Size(150, 30); questionType.DropDownWidth = 150; questionType.Items.Add("Open vraag"); questionType.Items.Add("Stelling"); questionType.Items.Add("Multiple choice (2)"); questionType.Items.Add("Multiple choice (3)"); questionType.Items.Add("Multiple choice (4)"); questionType.Items.Add("Multiple choice (5)"); questionType.Items.Add("Multiple choice (6)"); questionType.SelectedItem = "Open vraag"; // Add buttons to addQuestionAndSavePanel addQuestionAndSavePanel.Controls.Add(AddQuestionButton); addQuestionAndSavePanel.Controls.Add(Save); addQuestionAndSavePanel.Controls.Add(StartOver); addQuestionAndSavePanel.Controls.Add(questionType); questionFlowPanel.Controls.Add(addQuestionAndSavePanel); panelCounter++; }
private static void ShowExpandedMessageBox(string messageString) { var messageForm = new Form(){Size = new Size(500,300)}; var splitContainer = new SplitContainer() { Dock = DockStyle.Fill, IsSplitterFixed = true, SplitterWidth = 1, SplitterDistance = 300, Orientation = Orientation.Horizontal, Panel2MinSize = 20 }; splitContainer.Resize += (x, y) => { splitContainer.SplitterDistance = messageForm.Size.Height - 67; }; var okButton = new Button { DialogResult = DialogResult.OK, Text = "Ok", Anchor = (AnchorStyles.Right | AnchorStyles.Top), //Location = new System.Drawing.Point(414, 4), Size = new Size(75,23), Dock = DockStyle.Right }; splitContainer.Panel2.Controls.Add(okButton); var textBox = new TextBox { Multiline = true, ScrollBars = ScrollBars.Both, Dock = DockStyle.Fill, Text = messageString.Trim(), ReadOnly = true, SelectionLength = 0, TabStop = false }; splitContainer.Panel1.Controls.Add(textBox); messageForm.Controls.Add(splitContainer); messageForm.ShowDialog(); okButton.Focus(); }