private void gluInits_EditValueChanged(object sender, EventArgs e) { XPTable table = (XPTable)gluInits.EditValue; DBInterface.TableType = table.Type; CreateInitData(); }
protected override void OnPaintBackground(XPTable.Events.PaintCellEventArgs e) { base.OnPaintBackground(e); if (!(e.Cell.Data is IComputer)) return; switch ((e.Cell.Data as IComputer).Connection) { case ConnectionState.Disconnected: double mid = ((int) this.BackColor.R + (int) this.BackColor.G + (int) this.BackColor.B) / 3; mid /= 1.2; BackColor = Color.FromArgb((int) mid, (int) mid, (int) mid); break; case ConnectionState.NotSupported: break; case ConnectionState.Connected: BackColor = Color.FromArgb( (int) ( BackColor.R / 1.2 ), (byte) ( BackColor.G + ((255 - BackColor.G) / 1.2) ), (int) ( BackColor.B / 1.2 ) ); break; } e.Graphics.FillRectangle(this.BackBrush, e.CellRect); }
/// <summary> /// Creates a new Instance for a default monster. /// </summary> /// <returns>A new monster with blank or default stats.</returns> public static MonsterStat BlankMonsterStat() { MonsterStat m = new MonsterStat(); m.HitPoints = 5; m.HitDice = "1d8"; m.ChallengeRating = "1"; m.XP = XPTable.XPbyCR(m.ChallengeRating).ToString(); return(m); }
protected override void OnPaint(XPTable.Events.PaintCellEventArgs e) { if (!(e.Cell.Data is IComputer)) return; if (foreBrush == null || foreBrush.Color != e.Table.ForeColor) foreBrush = new SolidBrush(e.Table.ForeColor); e.Graphics.DrawString((e.Cell.Data as IComputer).Hostname, e.Table.Font, foreBrush, e.CellRect); }
protected override void OnPaint(XPTable.Events.PaintCellEventArgs e) { if (foreBrush == null || foreBrush.Color != e.Table.ForeColor) foreBrush = new SolidBrush(e.Table.ForeColor); if (!(e.Cell.Data is HostDifferences)) { e.Graphics.DrawString(Properties.Resources.hostDifferences_Unaviable, e.Table.Font, foreBrush, e.CellRect); return; } e.Graphics.DrawString((e.Cell.Data as HostDifferences).LocalizedDescription, e.Table.Font, foreBrush, e.CellRect); }
public void GainXP(int amount) { stats.xp += amount; int newLevel = XPTable.LvlAtXP(stats.xp, stats.levelingRate, stats.lvl); /*switch(stats.levelingRate) * { * case LevelingRate.Erratic: * // TODO: implement the actual formula. * newLevel = (int)Mathf.Pow(stats.xp * 5f / 4f, 1f / 3f); * break; * * case LevelingRate.Fast: * newLevel = (int)Mathf.Pow(stats.xp * 5f / 4f, 1f / 3f); * break; * * case LevelingRate.MediumFast: * newLevel = (int)Mathf.Pow(stats.xp, 1f / 3f); * break; * * case LevelingRate.MediumSlow: * // TODO: implement the actual formula. * newLevel = (int)Mathf.Pow(stats.xp, 1f / 3f); * break; * * case LevelingRate.Slow: * newLevel = (int)Mathf.Pow(stats.xp * 4f / 5f, 1f / 3f); * break; * * case LevelingRate.Fluctuating: * // TODO: implement the actual formula. * newLevel = (int)Mathf.Pow(stats.xp * 5 / 4, 1/3); * break; * * default: * Debug.LogError("Unknown leveling rate."); * break; * }*/ if (stats.lvl < newLevel) { LevelUp(newLevel); } }
/// <summary> /// Handles the SelectionChanged event of the tableCards control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="XPTable.Events.SelectionEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev05, 2007-10-01</remarks> private void tableCards_SelectionChanged(object sender, XPTable.Events.SelectionEventArgs e) { if (!selectingCard) selectionTimer.Start(); }
private void table1_CellDoubleClick(object sender, XPTable.Events.CellMouseEventArgs e) { if (table1.TableModel.Rows.Count > 0) { try { var row = e.Row; var name = (table1.TableModel.Rows[row].Cells[0].Text == "000000") ? "ลูกค้าทั่วไป" : table1.TableModel.Rows[row].Cells[2].Text + ((table1.TableModel.Rows[row].Cells[4].Text != "") ? " (" + table1.TableModel.Rows[row].Cells[4].Text + ")" : ""); Param.SelectCustomerId = table1.TableModel.Rows[row].Cells[0].Text; Param.SelectCustomerName = name; Param.SelectCustomerAge = table1.TableModel.Rows[row].Cells[8].Text == "" ? 0 : (int)DateTime.Today.Subtract(Convert.ToDateTime(table1.TableModel.Rows[row].Cells[8].Text).Date).TotalDays / 365; //Param.SelectCustomerAge = Param.SelectCustomerAge == DateTime.Today.Year ? 0 : Param.SelectCustomerAge; Param.SelectCustomerSex = table1.TableModel.Rows[row].Cells[9].Text; Param.SelectCustomerSellPrice = int.Parse(table1.TableModel.Rows[row].Cells[10].Text); Firstname = table1.TableModel.Rows[row].Cells[2].Text; Lastname = table1.TableModel.Rows[row].Cells[3].Text; Nickname = table1.TableModel.Rows[row].Cells[4].Text; tel = table1.TableModel.Rows[row].Cells[6].Text; this.DialogResult = DialogResult.OK; //this.Dispose(); } catch { } } }
private void table1_CellDoubleClick(object sender, XPTable.Events.CellMouseEventArgs e) { if(e.Row < table1.RowCount){ FmAddCustomer ul = new FmAddCustomer(); ul.LoadCustomerData(sender, e, "Mobile", tableModel1.Rows[e.Row].Cells[8].Text.Replace("-", "")); var result = ul.ShowDialog(this); if (result == System.Windows.Forms.DialogResult.OK) { LoadData(); } } }
/// <summary> /// Handles the CellPropertyChanged event of the tableCards control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="XPTable.Events.CellEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev05, 2007-10-01</remarks> private void tableCards_CellPropertyChanged(object sender, XPTable.Events.CellEventArgs e) { if (tableCards.TableModel.Rows.Count > 0 && buttonStart.Enabled) LoadCardForEditing(); }
private void tableFrames_SelectionChanged(object sender, XPTable.Events.SelectionEventArgs e) { bool enabledState = (this.SelectedAnimationFrameIndex > -1); toolStripButtonDeleteKeyFrame.Enabled = enabledState; }
private void LockTable(XPTable.Models.Table table) { foreach (XPTable.Models.Row row in table.TableModel.Rows) { row.Editable = false; } table.BackColor = Color.LightGray; table.AlternatingRowColor = Color.LightGray; table.AllowSelection = false; }
/// <summary> /// Xuất dữ liệu ra file excel /// </summary> /// <param name="table"></param> /// <param name="Title"></param> /// <returns></returns> public bool ExportExcel(XPTable.Models.Table table, String Title) { System.Threading.Thread thisThread = System.Threading.Thread.CurrentThread; CultureInfo originalCulture = thisThread.CurrentCulture; thisThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); try { // Launch Excel and make sure there is an open workbook. Excel.Application excel = new Excel.Application(); ColumnModel columnModel = table.ColumnModel; Workbook book = excel.Workbooks.Add(XlSheetType.xlWorksheet); Worksheet sheet = (Worksheet)book.ActiveSheet; Range rCompanyName = (Range)sheet.Cells[1, "A"]; // di chuyển con trỏ đến hàng 1 cột A rCompanyName.Value2 = "CÔNG TY TNHH ESTELLE VIỆT NAM";// điền dữ liệu vào cell rCompanyName.Font.Bold = true; Range rTitle = (Range)sheet.Cells[2, "N"]; // di chuyển con trỏ đến hàng 2 cột N rTitle.Value2 = Title;// điền dữ liệu vào cell rTitle.Font.Bold = true; int rowIndex = 4; // Bắt đầu điền dữ liệu từ XPTable vào bảng Excel từ hàng thứ 4 int colIndex = 0; // Fill the worksheet column headings from the dataset. foreach (Column col in columnModel.Columns) { colIndex++; Excel.Range cell = (Excel.Range)excel.Cells[4, colIndex]; cell.Value2 = col.Text; cell.ColumnWidth = col.Width / 6; cell.Font.Bold = true; } // Điền dữ liệu từ listview vào file excel for (rowIndex = 0; rowIndex < table.RowCount; rowIndex++) { for (colIndex = 0; colIndex < columnModel.Columns.Count; colIndex++) { if (table.TableModel.Rows[rowIndex].Cells[colIndex].ForeColor == table.AlternatingRowColor) { excel.Cells[rowIndex + 5, colIndex + 1] = ""; } else { if (columnModel.Columns[colIndex] is TextColumn) { excel.Cells[rowIndex + 5, colIndex + 1] = table.TableModel.Rows[rowIndex].Cells[colIndex].Text; } //else //{ // excel.Cells[rowIndex + 5, colIndex + 1] = table.TableModel.Rows[rowIndex].Cells[colIndex].Data; //} //if (colIndex + 1 == 18) //{ // excel.Cells[rowIndex + 5, 18] = Convert.ToDateTime(table.TableModel.Rows[rowIndex].Cells[colIndex].Text).ToString("dd/MM/yyyy"); //} } } } //for (int i = 5; i < table.RowCount; i++) //{ //excel.Cells[i, 18] = Convert.ToDateTime(table.TableModel.Rows[i].Cells[18].Text).ToString("dd/MM/yyyy"); // excel.Cells[i, 20] = string.Format( //} excel.Visible = true; return true; // Xuất excel thành công } catch (Exception ex) { MessageBox.Show(ex.ToString()); return false; // Xuất excel thất bại } finally { thisThread.CurrentCulture = originalCulture; } }
private void lvwListInsurance_SelectionChanged(object sender, XPTable.Events.SelectionEventArgs e) { if (e.NewSelectedIndicies.Length > 0) { SelectedItem = (int)lvwListInsurance.TableModel.Rows[e.NewSelectedIndicies[0]].Tag; } }
private void lvwSocialInsuranceSheet_SelectionChanged(object sender, XPTable.Events.SelectionEventArgs e) { if (e.NewSelectedIndicies.Length > 0) { selectedRowIndex = (int)lvwSocialInsuranceSheet.TableModel.Rows[e.NewSelectedIndicies[0]].Tag; } }
private void lvwRestSheet_EditingStopped_1(object sender, XPTable.Events.CellEditEventArgs e) { int row = e.Row; double dOldValuePri = GetCellValue(e.Cell.Text); double dNewValuePri = GetCellValue(((TextCellEditor)e.Editor).TextBox.Text); if (dNewValuePri < 0) //Lỗi nhập giá trị < 0 { MessageBox.Show(this, WorkingContext.LangManager.GetString("frmRestSheet_Messa1"), WorkingContext.LangManager.GetString("Message"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int iMonthPri = e.Column - 3; int iEmployeeIDPri = Convert.ToInt32(dsRestSheet.Tables[0].Rows[row]["EmployeeID"]); float fRestInMonthPri = restsheetDO.GetRestInMonth(iEmployeeIDPri, CurrentYear, iMonthPri); if (Convert.ToDouble(fRestInMonthPri) != dNewValuePri) //Lỗi khi số ngày nghỉ > tổng số ngày đã đăng ký nghỉ trong tháng { MessageBox.Show(this, string.Format(WorkingContext.LangManager.GetString("frmRestSheet_Error1_Messa"), iMonthPri, fRestInMonthPri), WorkingContext.LangManager.GetString("Message"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { double dTotalRestPri = 0; for (int i = 4; i < 16; i++) { if (i != e.Column) dTotalRestPri += GetCellValue(lvwRestSheet.TableModel.Rows[row].Cells[i].Text); } dTotalRestPri += dNewValuePri; if (dTotalRestPri > GetCellValue(lvwRestSheet.TableModel.Rows[row].Cells[18].Text)) //Lỗi tổng số ngày nghỉ > số ngày được phép nghỉ { MessageBox.Show(this, WorkingContext.LangManager.GetString("frmRestSheet_Error2_Messa"), WorkingContext.LangManager.GetString("Message"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } double dTotalremainPri = GetCellValue(lvwRestSheet.TableModel.Rows[row].Cells[19].Text); dTotalremainPri = dTotalremainPri + dOldValuePri - dNewValuePri; if (dTotalremainPri < 0) { dTotalremainPri = 0; } double dBasicSalaryPri = double.Parse((lvwRestSheet.TableModel.Rows[row].Cells[20].Data).ToString()); double dAllowancePri = double.Parse((lvwRestSheet.TableModel.Rows[row].Cells[21].Data).ToString()); double dAllowMoneyPri = dBasicSalaryPri + dAllowancePri; dAllowMoneyPri = (dTotalremainPri * dAllowMoneyPri) / 24; int iTempPri = Convert.ToInt32(dAllowMoneyPri / 100); iTempPri = iTempPri * 100; dAllowMoneyPri = (double)iTempPri; lvwRestSheet.TableModel.Rows[row].Cells[16].Text = dTotalRestPri.ToString(); lvwRestSheet.TableModel.Rows[row].Cells[19].Text = dTotalremainPri.ToString(); lvwRestSheet.TableModel.Rows[row].Cells[22].Data = dAllowMoneyPri; } } }
private void lvwSocialInsuranceSheet_EditingStopped(object sender, XPTable.Events.CellEditEventArgs e) { e.Handled = true; // int row = e.Row; // double RestDays = GetCellValue(lvwSocialInsuranceSheet.TableModel.Rows[row].Cells[8].Text); double BasicSalary = (double)lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cBasicSalary)].Data; double RestDays = (double)lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cRestDayInTerm)].Data; // double RestDayInYear = (double)lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cRestDayInYear)].Data; double RestDaysApproved = (double)lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cRestDayApproved)].Data; double oldValue = GetCellValue(e.Cell.Data.ToString()); double newValue = GetCellValue(((NumberCellEditor)e.Editor).TextBox.Text); if (e.Column == columnModel1.Columns.IndexOf(cRestDayInTerm)) //Khấu trừ ăn trưa { RestDays = newValue;; } else if(e.Column == columnModel1.Columns.IndexOf(cRestDayApproved)) { RestDaysApproved = newValue; } // BasicSalary = BasicSalary - oldValue + newValue; // RestDays = RestDays - oldValue+ newValue; // RestDayInYear = RestDayInYear - oldValue+ newValue; // RestDaysApproved = RestDaysApproved - oldValue + newValue; // double MoneyAllowance = Math.Floor(RestDays*(BasicSalary/25)*0.75); double MoneyAllowance = RestDays*(BasicSalary*0.75)/25; double MoneyAllowanceApproved = RestDaysApproved*(BasicSalary*0.75)/25; // lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[e.Column].Data = newValue; lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cRestDayInTerm)].Data = RestDays; lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cRestDayApproved)].Data = RestDaysApproved; lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cMoneyAllowance)].Data = MoneyAllowance; lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cMoneyAllowanceApproved)].Data = MoneyAllowanceApproved; // lvwSocialInsuranceSheet.TableModel.Rows[e.Row].Cells[columnModel1.Columns.IndexOf(cRestDayApproved)].Data = RestDays; }
void table_CellClick(object sender, XPTable.Events.CellMouseEventArgs e) { if (e.Column == 0) { // A cell in the first column has been clicked, go through this sequence: // 1. Show Red circle // 2. Show orange circle // 3. Show something else object data = e.Cell.Row.Cells[1].Data; if (data is Color) { if ((Color)data == Color.Orange) e.Cell.Row.Cells[1].Data = ""; // 3. else e.Cell.Row.Cells[1].Data = Color.Orange; // 2. } else { e.Cell.Row.Cells[1].Data = Color.Red; // 1. } } }
private void table1_CellDoubleClick(object sender, XPTable.Events.CellMouseEventArgs e) { if (e.Row < table1.RowCount) { row = e.Row; } if (row != -1) { productNo = tableModel1.Rows[row].Cells[1].Text; //if (cbbOrder.SelectedIndex == 0) { OrderNo = cbbOrderNo.SelectedItem.ToString(); } else { OrderNo = cbbOrder.SelectedItem.ToString(); } //ProductName = tableModel1.Rows[row].Cells[2].Text; FmChangeSellPrice frm = new FmChangeSellPrice(); var result = frm.ShowDialog(this); if (result == DialogResult.OK) { LoadData(); } } else { MessageBox.Show("กรุณาเลือกรายการที่ต้องการ", "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Raises the MouseMove event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseMove(XPTable.Events.CellMouseEventArgs e) { base.OnMouseMove(e); if (this.ShowUpDownButtons || this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the button renderer data NumberRendererData rendererData = this.GetNumberRendererData(e.Cell); if (this.GetUpButtonBounds().Contains(e.X, e.Y)) { if (rendererData.UpButtonState == UpDownStates.Normal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { if (this.GetUpButtonBounds().Contains(rendererData.ClickPoint)) { rendererData.UpButtonState = UpDownStates.Pressed; if (this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { ((IEditorUsesRendererButtons) e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e); } } else if (this.GetDownButtonBounds().Contains(rendererData.ClickPoint)) { rendererData.DownButtonState = UpDownStates.Normal; if (this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { ((IEditorUsesRendererButtons) e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e); } } } else { rendererData.UpButtonState = UpDownStates.Hot; if (rendererData.DownButtonState == UpDownStates.Hot) { rendererData.DownButtonState = UpDownStates.Normal; } } e.Table.Invalidate(e.CellRect); } } else if (this.GetDownButtonBounds().Contains(e.X, e.Y)) { if (rendererData.DownButtonState == UpDownStates.Normal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { if (this.GetDownButtonBounds().Contains(rendererData.ClickPoint)) { rendererData.DownButtonState = UpDownStates.Pressed; if (this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { ((IEditorUsesRendererButtons) e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e); } } else if (this.GetUpButtonBounds().Contains(rendererData.ClickPoint)) { rendererData.UpButtonState = UpDownStates.Normal; if (this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { ((IEditorUsesRendererButtons) e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e); } } } else { rendererData.DownButtonState = UpDownStates.Hot; if (rendererData.UpButtonState == UpDownStates.Hot) { rendererData.UpButtonState = UpDownStates.Normal; } } e.Table.Invalidate(e.CellRect); } } else { if (rendererData.UpButtonState != UpDownStates.Normal || rendererData.DownButtonState != UpDownStates.Normal) { rendererData.UpButtonState = UpDownStates.Normal; rendererData.DownButtonState = UpDownStates.Normal; if (this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { ((IEditorUsesRendererButtons) e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e); } e.Table.Invalidate(e.CellRect); } } } } }
private void UnlockTable(XPTable.Models.Table table) { foreach (XPTable.Models.Row row in table.TableModel.Rows) { row.Editable = true; } table.BackColor = Color.White; table.AlternatingRowColor = Color.WhiteSmoke; table.AllowSelection = true; }
void table_CellPropertyChanged(object sender, XPTable.Events.CellEventArgs e) { if (e.EventType != CellEventType.ValueChanged) return; if (Changed != null) Changed(this, e); UpdateIconAndInfo(e.Row); }
private void lvwPunishCard_SelectionChanged(object sender, XPTable.Events.SelectionEventArgs e) { if (e.NewSelectedIndicies.Length > 0) { selectedRowIndex = (int)lvwPunishCard.TableModel.Rows[e.NewSelectedIndicies[0]].Tag; LoadPunishCard(); } }
private void tableFrames_CellPropertyChanged(object sender, XPTable.Events.CellEventArgs e) { AnimationFrame newFrame = new AnimationFrame(); // Duration if (e.Cell.Data != null) { newFrame.Duration = Int32.Parse(e.Cell.Data.ToString()); newFrame.Area = this.SelectedAnimationInfo.AnimationFrames[this.SelectedAnimationFrameIndex].Area; SelectedAnimationInfo.Reset(); } else { newFrame.Area = e.Cell.Text; newFrame.Duration = this.SelectedAnimationInfo.AnimationFrames[this.SelectedAnimationFrameIndex].Duration; } this.SelectedAnimationInfo.AnimationFrames[this.SelectedAnimationFrameIndex] = newFrame; }
void _templateTable_AfterEditing(object sender, XPTable.Events.CellEditEventArgs e) { if (preview != null) { // reset preview preview.PreviewList.Items.Clear(); } editingCategoryItem = null; Row currentRow = _templateTable.TableModel.Rows[e.Row]; CategoryItem currentItem = (CategoryItem)currentRow.Tag; if (e.Column == 0) { // The Pattern column currentItem.Value = e.Cell.Text; } else if (e.Column == 1) { // The Type column currentItem.Type = (CategoryItemType)Enum.Parse(typeof(CategoryItemType), e.Cell.Text); } else if (e.Column == 2) { // The Category column SetCategory(currentItem, e.Cell.Text); } }
private void lvwListEmployee_SelectionChanged(object sender, XPTable.Events.SelectionEventArgs e) { if (e.NewSelectedIndicies.Length > 0) { selectedRowIndex = (int)lvwListEmployee.TableModel.Rows[e.NewSelectedIndicies[0]].Tag; } }
/// <summary> /// Handles the CellButtonClicked event of the tableCards control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="XPTable.Events.CellButtonEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev05, 2007-09-27</remarks> private void tableCards_CellButtonClicked(object sender, XPTable.Events.CellButtonEventArgs e) { tableCards.TableModel.Rows.RemoveAt(e.Cell.Row.Index); if (tableCards.TableModel.Rows.Count == 0) tableCards.GridLines = GridLines.None; if (e.Cell.Row == currentItem) position = 50; }
void tableIncludes_Changed(object sender, XPTable.Events.CellEventArgs e) { SaveTo(folder); tableTester.ReEval(folder); }
private void table_CellKeyUp(object sender, XPTable.Events.CellKeyEventArgs e) { if (e.KeyCode == Keys.Delete) { RowCollection rows = e.Table.TableModel.Rows; rows.Remove(rows[e.Row]); } }
/// <summary> /// Raises the MouseMove event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseMove(XPTable.Events.CellMouseEventArgs e) { base.OnMouseMove(e); if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the button renderer data DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y)) { if (rendererData.ButtonState == ComboBoxStates.Normal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { rendererData.ButtonState = ComboBoxStates.Pressed; } else { rendererData.ButtonState = ComboBoxStates.Hot; } e.Table.Invalidate(e.CellRect); } } else { if (rendererData.ButtonState != ComboBoxStates.Normal) { rendererData.ButtonState = ComboBoxStates.Normal; e.Table.Invalidate(e.CellRect); } } } } }
private void table1_CellClick(object sender, XPTable.Events.CellMouseEventArgs e) { if (e.Row < table1.RowCount) { row = e.Row; } }
/// <summary> /// Raises the MouseMove event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseMove(XPTable.Events.CellMouseEventArgs e) { base.OnMouseMove(e); if (e.Table.IsCellEditable(e.CellPos)) { // get the renderer data CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell); if (this.CalcCheckRect(e.Table.TableModel.Rows[e.Row].Alignment, e.Table.ColumnModel.Columns[e.Column].Alignment).Contains(e.X, e.Y)) { if (e.Cell.CheckState == CheckState.Checked) { if (rendererData.CheckState == CheckBoxStates.CheckedNormal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { rendererData.CheckState = CheckBoxStates.CheckedPressed; } else { rendererData.CheckState = CheckBoxStates.CheckedHot; } e.Table.Invalidate(e.CellRect); } } else if (e.Cell.CheckState == CheckState.Indeterminate) { if (rendererData.CheckState == CheckBoxStates.MixedNormal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { rendererData.CheckState = CheckBoxStates.MixedPressed; } else { rendererData.CheckState = CheckBoxStates.MixedHot; } e.Table.Invalidate(e.CellRect); } } else //if (e.Cell.CheckState == CheckState.Unchecked) { if (rendererData.CheckState == CheckBoxStates.UncheckedNormal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { rendererData.CheckState = CheckBoxStates.UncheckedPressed; } else { rendererData.CheckState = CheckBoxStates.UncheckedHot; } e.Table.Invalidate(e.CellRect); } } } else { if (e.Cell.CheckState == CheckState.Checked) { rendererData.CheckState = CheckBoxStates.CheckedNormal; } else if (e.Cell.CheckState == CheckState.Indeterminate) { rendererData.CheckState = CheckBoxStates.MixedNormal; } else //if (e.Cell.CheckState == CheckState.Unchecked) { rendererData.CheckState = CheckBoxStates.UncheckedNormal; } e.Table.Invalidate(e.CellRect); } } }
private void table1_CellDoubleClick(object sender, XPTable.Events.CellMouseEventArgs e) { miDetail_Click((sender), e); }