public void Fill(ParticipantList participants) { if (participants == null) { return; } tableParticipants.TableModel.Rows.Clear(); foreach (Participant p in participants) { Cell[] cells = new Cell[4]; //string[] cells = new string[4]; cells[0] = new Cell(p.Role); cells[1] = new Cell(p.Name); if (p.TrackNumber > 0) { cells[2] = new Cell(p.TrackNumber); } else { cells[2] = new Cell(""); } cells[3] = new Cell(p.Comment); XPTable.Models.Row row = new XPTable.Models.Row(cells); tableParticipants.TableModel.Rows.Add(row); } }
void VisualizeEvent(LogEvent e) { XPTable.Models.Row row = new XPTable.Models.Row(); XPTable.Models.Cell cell1 = new XPTable.Models.Cell(); XPTable.Models.CellStyle cellStyle1 = new XPTable.Models.CellStyle(); XPTable.Models.Cell cell2 = new XPTable.Models.Cell(); XPTable.Models.CellStyle cellStyle2 = new XPTable.Models.CellStyle(); cell1.Data = e.time; cell1.ToolTipText = e.time.ToString("dd.MM.yyyy"); cell2.Image = e.icon; cell2.Text = e.text; if (e.lines.Length == 1) { cell2.ToolTipText = e.lines[0].Second; } row.Cells.AddRange(new XPTable.Models.Cell[] { cell1, cell2 }); row.ChildIndex = 0; row.Editable = false; row.Tag = e; tableModel.Rows.Add(row); publishedEvents.Add(e, row); }
private void DoColspan() { Table table = this.table; // The Table control on a form - already initialised table.SelectionStyle = SelectionStyle.Grid; table.BeginUpdate(); table.EnableWordWrap = true; // If false, then Cell.WordWrap is ignored table.GridLines = GridLines.Rows; TextColumn col1 = new TextColumn("col A", 100); TextColumn col2 = new TextColumn("col B", 100); TextColumn col3 = new TextColumn("col C", 100); table.ColumnModel = new ColumnModel(new Column[] { col1, col2, col3 }); TableModel model = new TableModel(); Row row; Cell cell; // Add all 3 cells for row 1 row = new Row(); row.Cells.Add(new Cell("Short 1a")); //row1.Cells.Add(new Cell("Short 1")); cell = new Cell("This is long text that will just be truncated"); row.Cells.Add(cell); row.Cells.Add(new Cell("Short 1c")); model.Rows.Add(row); // Add only 2 cells for row 2 row = new Row(); row.Cells.Add(new Cell("Short 2a")); cell = new Cell("This is text that will go over to the next column"); cell.ColSpan = 2; // The row height will be increased so we can see all the text row.Cells.Add(cell); // We don't add the next cell model.Rows.Add(row); // Add all 3 cells for row 3 row = new Row(); row.Cells.Add(new Cell("Short 3")); //row1.Cells.Add(new Cell("Short 1")); cell = new Cell("This is a cell with some really long text that wraps more than the other text"); cell.WordWrap = true; // The row height will be increased so we can see all the text row.Cells.Add(cell); row.Cells.Add(new Cell("Short 3c")); model.Rows.Add(row); // Add only 2 cells for row 4 row = new Row(); row.Cells.Add(new Cell("Short 4")); cell = new Cell("This is a cell with some really long text that wraps more than the other text"); cell.WordWrap = true; // Colspan and Wordwrap!! cell.ColSpan = 2; row.Cells.Add(cell); model.Rows.Add(row); this.table.TableModel = model; this.table.EndUpdate(); }
private void AddEmailRows(TableModel table, bool read, string from, string sent, string subject, string preview) { Row row = new Row(); row.Cells.Add(new Cell()); // always starts off showing all subrows row.Cells.Add(new Cell("", read ? _read : _unread)); row.Cells.Add(new Cell(from)); row.Cells.Add(new Cell(DateTime.Parse(sent))); row.Cells.Add(new Cell("hi")); table.Rows.Add(row); // Add a sub-row that shows just the email subject in grey (single line only) Row subrow = new Row(); subrow.Cells.Add(new Cell()); // Extra column for +/- subrow.Cells.Add(new Cell()); Cell cell = new Cell(subject); cell.ForeColor = Color.Gray; cell.ColSpan = 3; subrow.Cells.Add(cell); row.SubRows.Add(subrow); // Add a sub-row that shows just a preview of the email body in blue, and wraps too subrow = new Row(); subrow.Cells.Add(new Cell()); // Extra column for +/- subrow.Cells.Add(new Cell()); cell = new Cell(preview); cell.ForeColor = Color.Blue; cell.ColSpan = 3; cell.WordWrap = true; subrow.Cells.Add(cell); row.SubRows.Add(subrow); }
/// <summary> /// Initializes a new instance of the CellCollection class /// that belongs to the specified Row /// </summary> /// <param name="owner">A Row representing the row that owns /// the Cell collection</param> public CellCollection(Row owner) : base() { if (owner == null) { throw new ArgumentNullException("owner"); } this.owner = owner; }
private void AddRow(TableModel table, int index, double height, string text, string surname, string date, string more) { Row row = new Row(); row.Cells.Add(new Cell(index)); row.Cells.Add(new Cell(height)); row.Cells.Add(new Cell(text)); row.Cells.Add(new Cell(surname)); row.Cells.Add(new Cell(DateTime.Parse(date))); row.Cells.Add(new Cell(more)); table.Rows.Add(row); }
void PlayerSkills_SkillChanged(object sender, SkillChangedEventArgs e) { int id = e.Value.ID; if (id < 0) throw new InternalErrorException("id < 0 in Skills.PlayerSkills_SkillChanged()"); Row row = null; foreach (Row r in tableModel.Rows) { if (id.Equals(r.Tag)) { row = r; break; } } if (row == null) { row = new Row(); row.Tag = id; row.Cells.Add(new Cell()); row.Cells.Add(new Cell(id.ToString())); row.Cells.Add(new Cell()); row.Cells.Add(new Cell()); row.Cells.Add(new Cell()); row.Cells.Add(new Cell()); row.Cells[0].Enabled = false; if (id < DataFiles.Skills.Count) { SkillData data = DataFiles.Skills[id]; row.Cells[1].Text = data.Name; if (data.Action) { row.Cells[0].Image = null; row.Cells[0].Enabled = true; } } tableModel.Rows.Add(row); } row.Cells[2].Data = (float)(e.Value.RealValue / 10.0f); row.Cells[3].Data = (float)(e.Value.Value / 10.0f); if (oldSkills.ContainsKey(id)) row.Cells[4].Data = (float)((e.Value.RealValue - oldSkills[id]) / 10.0f); else { row.Cells[4].Data = 0; oldSkills.Add(id, e.Value.RealValue); } table.Sort(); }
private void DoWrap() { Table table = this.table; // The Table control on a form - already initialised table.BeginUpdate(); table.EnableWordWrap = true; // If false, then Cell.WordWrap is ignored table.SelectionStyle = SelectionStyle.Grid; table.GridLines = GridLines.Rows; TextColumn col1 = new TextColumn("col A", 100); TextColumn col2 = new TextColumn("col B", 100); table.ColumnModel = new ColumnModel(new Column[] { col1, col2 }); TableModel model = new TableModel(); Row row; Cell cell; row = new Row(); row.Cells.Add(new Cell("Short 1")); //row1.Cells.Add(new Cell("Short 1")); cell = new Cell("This is a cell with quite long text"); cell.WordWrap = true; // The row height will be increased so we can see all the text row.Cells.Add(cell); model.Rows.Add(row); row = new Row(); row.Cells.Add(new Cell("Short 2")); cell = new Cell("This is long text that will just be truncated"); cell.WordWrap = false; // Not needed - it is false by default row.Cells.Add(cell); model.Rows.Add(row); row = new Row(); row.Cells.Add(new Cell("Short 3")); //row1.Cells.Add(new Cell("Short 1")); cell = new Cell("This is a cell with some really long text that wraps more than the other text"); cell.WordWrap = true; // The row height will be increased so we can see all the text row.Cells.Add(cell); model.Rows.Add(row); row = new Row(); row.Cells.Add(new Cell("Short ")); cell = new Cell("This is long text that will just be truncated"); cell.WordWrap = false; // Not needed - it is false by default row.Cells.Add(cell); model.Rows.Add(row); this.table.TableModel = model; this.table.EndUpdate(); }
/// <summary> /// Adds the specified Row to the end of the collection /// </summary> /// <param name="row">The Row to add</param> public int Add(Row row) { if (row == null) { throw new System.ArgumentNullException("Row is null"); } int index = this.List.Add(row); this.OnRowAdded(new TableModelEventArgs(this.owner, row, index, index)); return index; }
private void AddEmailRows(TableModel table, bool read, string from, string sent, string subject, string preview) { Row row = new Row(); //row.Alignment = RowAlignment.Top; row.Cells.Add(new Cell()); // always starts off showing all subrows row.Cells.Add(new Cell("", read ? _read : _unread)); Cell fro = new Cell(null); //from); fro.WordWrap = true; row.Cells.Add(fro); Cell cellSent = new Cell(DateTime.Parse(sent)); if (sent == "5/4/2007 9:13") { cellSent.CellStyle = new CellStyle(ColumnAlignment.Left); cellSent.CellStyle.LineAlignment = RowAlignment.Top; } row.Cells.Add(cellSent); row.Cells.Add(new Cell("hi")); row.RowStyle = new XPTable.Models.RowStyle(); row.RowStyle.Alignment = RowAlignment.Top; table.Rows.Add(row); // Add a sub-row that shows just the email subject in grey (single line only) Row subrow = new Row(); subrow.Cells.Add(new Cell()); // Extra column for +/- subrow.Cells.Add(new Cell()); subrow.RowStyle = new XPTable.Models.RowStyle(); subrow.RowStyle.Alignment = RowAlignment.Bottom; Cell cell = new Cell(subject); cell.ForeColor = Color.Gray; cell.ColSpan = 3; subrow.Cells.Add(cell); row.SubRows.Add(subrow); // Add a sub-row that shows just a preview of the email body in blue, and wraps too subrow = new Row(); subrow.Cells.Add(new Cell()); // Extra column for +/- subrow.Cells.Add(new Cell()); cell = new Cell(preview); cell.ForeColor = Color.Blue; cell.ColSpan = 3; cell.WordWrap = true; subrow.RowStyle = new XPTable.Models.RowStyle(); subrow.RowStyle.Alignment = RowAlignment.Bottom; subrow.Cells.Add(cell); row.SubRows.Add(subrow); }
private void DoControl() { Table table = this.table; // The Table control on a form - already initialised table.SelectionStyle = SelectionStyle.Grid; table.BeginUpdate(); table.EnableWordWrap = true; // If false, then Cell.WordWrap is ignored table.GridLines = GridLines.None; TextColumn col1 = new TextColumn("From", 200); ControlColumn col2 = new ControlColumn(30); col2.Alignment = ColumnAlignment.Right; SpinnerFactory fact = new SpinnerFactory(); //fact.ClickEventHandler = new EventHandler(circle_Click); col2.ControlFactory = fact; col2.ControlSize = new Size(25, 25); col2.Alignment = ColumnAlignment.Center; ControlColumn col3 = new ControlColumn(100); col3.Alignment = ColumnAlignment.Right; col3.ControlFactory = new TextBoxFactory(); table.ColumnModel = new ColumnModel(new Column[] { col1, col2, col3 }); TableModel model = new TableModel(); model.RowHeight = 25; // Change the height of all rows so the control can be seen Row row; row = new Row(); row.Cells.Add(new Cell("Text")); row.Cells.Add(new Cell(Color.Red)); // The .Data property is picked up as the colour in the SpinnerFactory row.Cells.Add(new Cell("Apples")); // The .Text property is picked up in the text in the TextboxFactory model.Rows.Add(row); row = new Row(); row.Cells.Add(new Cell("More")); row.Cells.Add(new Cell()); row.Cells.Add(new Cell("Pears")); model.Rows.Add(row); this.table.TableModel = model; //this.table.CellClick += new XPTable.Events.CellMouseEventHandler(table_CellClick); this.table.EndUpdate(); }
private void FillDataGrid(List <Pdf2JpgFileInfo> pdfFiles) { var rowStyle = new RowStyle { Font = new Font("微软雅黑", 9f, FontStyle.Regular) }; var index = this.tableFiles.TableModel.Rows.Count; var sameFilesName = new List <string>(); foreach (var pdfFile in pdfFiles) { if (IsExistSameFileName(pdfFile.FileName)) { sameFilesName.Add(pdfFile.FileName); continue; } var row = new Row(); row.Cells.AddRange(new Cell[] { new Cell(pdfFile.FileName, Properties.Resources.pdf_ico), new Cell(Utils.CountSize(Utils.GetFileSize(pdfFile.FilePath))), new Cell(1), new Cell(100), new Cell(0), new Cell("删除", Properties.Resources.trash_empty), new Cell(pdfFile.FilePath) }); row.Tag = ConvertState.NotConvert; this.tableFiles.TableModel.Rows.Add(row); this.tableFiles.TableModel.Rows[index].RowStyle = rowStyle; index++; } if (sameFilesName.Count > 0) { if (sameFilesName.Count > 5) { sameFilesName = sameFilesName.Take(5).ToList(); sameFilesName.Add("... ..."); } var height = sameFilesName.Count * 20 + 150; var strNames = string.Join("\n", sameFilesName); YMessageBox.ShowMsgBox(height, $"下列文件:\n{strNames}\n已存在,将忽略添加!"); } }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public void AddColumns(ColumnModel model) { this.model = model; CellStyle cellStyle = new CellStyle(); cellStyle.Padding = new CellPadding(6, 0, 0, 0); this.columnTable.BeginUpdate(); for (int i=0; i<model.Columns.Count; i++) { Row row = new Row(); Cell cell = new Cell(model.Columns[i].Text, model.Columns[i].Visible); cell.Tag = model.Columns[i].Width; cell.CellStyle = cellStyle; row.Cells.Add(cell); this.columnTable.TableModel.Rows.Add(row); } this.columnTable.SelectionChanged += new Events.SelectionEventHandler(OnSelectionChanged); this.columnTable.CellCheckChanged += new Events.CellCheckBoxEventHandler(OnCellCheckChanged); if (this.columnTable.VScroll) { this.columnTable.ColumnModel.Columns[0].Width -= SystemInformation.VerticalScrollBarWidth; } if (this.columnTable.TableModel.Rows.Count > 0) { this.columnTable.TableModel.Selections.SelectCell(0, 0); this.showButton.Enabled = !this.model.Columns[0].Visible; this.hideButton.Enabled = this.model.Columns[0].Visible; this.widthTextBox.Text = this.model.Columns[0].Width.ToString(); } this.columnTable.EndUpdate(); }
public void Init() { DataSet TypeSalary = DayType.GetTypeSalary(); tblTypeSalary.TableModel.Rows.Clear(); int STT =0; if (TypeSalary != null) { if(TypeSalary.Tables.Count > 0) { foreach (DataRow r in TypeSalary.Tables[0].Rows) { STT += 1; Row row = new Row(new string[] { STT.ToString(),r["SalaryName"].ToString(),r["SalaryDescription"].ToString(),r["ContractName"].ToString(),r["SalaryBasic"].ToString(),r["SalaryID"].ToString()}); tblTypeSalary.TableModel.Rows.Add(row); } } } }
private void UpdateTable() { iTable.BeginUpdate(); iTableModel.Rows.Clear(); // long total = iDistribution.Total; foreach (DictionaryEntry entry in iDistribution) { uint size = (uint)(entry.Key); uint instanceCount = (uint)entry.Value; uint totalForSize = size * instanceCount; double percentageDistribution = ((double)(totalForSize) / ((double)total)) * 100.0; double percentageHeap = ((double)(totalForSize) / ((double)TotalHeapSize)) * 100.0; string percentageTextDistribution = NumberFormattingUtils.NumberAsPercentageTwoDP(totalForSize, total) + " %"; string percentageTextHeap = NumberFormattingUtils.NumberAsPercentageTwoDP(totalForSize, TotalHeapSize) + " %"; // XPTable.Models.Row row = new XPTable.Models.Row(); // XPTable.Models.Cell cellSize = new XPTable.Models.Cell(size.ToString() + " bytes"); cellSize.Tag = size; XPTable.Models.Cell cellInstanceCount = new XPTable.Models.Cell(instanceCount.ToString()); cellInstanceCount.Data = instanceCount; XPTable.Models.Cell cellTotalForSize = new XPTable.Models.Cell(totalForSize.ToString()); cellTotalForSize.Data = totalForSize; XPTable.Models.Cell cellPercentage = new XPTable.Models.Cell(percentageTextDistribution); cellPercentage.Tag = percentageDistribution; XPTable.Models.Cell cellPercentageOfHeap = new XPTable.Models.Cell(percentageTextHeap); cellPercentageOfHeap.Tag = percentageHeap; // row.Cells.Add(cellSize); row.Cells.Add(cellInstanceCount); row.Cells.Add(cellTotalForSize); row.Cells.Add(cellPercentage); row.Cells.Add(cellPercentageOfHeap); // iTableModel.Rows.Add(row); } // iTable.EndUpdate(); }
private void LoadFrameList() { tableFrames.TableModel.Rows.Clear(); AnimationInfo selectedAnim = this.SelectedAnimationInfo; if (selectedAnim != null) { for (int i = 0; i < selectedAnim.AnimationFrames.Count; i++) { AnimationFrame frame = selectedAnim.AnimationFrames[i]; Cell[] cells = new Cell[2]; cells[0] = new Cell(frame.Area); cells[1] = new Cell((object)frame.Duration); Row newRow = new Row(cells); tableFrames.TableModel.Rows.Add(newRow); } tableFrames.TableModel.Selections.AddCell(0, 1); } }
/// <summary> /// Dien thong tin nhan vien un'g voi' phong duoc chon /// </summary> private void LoadEmployeeeInDepartment() { // dsLunch = lunchDO.GetLunch((int)departmentTreeView.SelectedNode.Tag, dtpWorkingDay.Value.Date); dsEmployee = employeeDO.GetEmployeeByDepartment((int)departmentTreeView.SelectedNode.Tag); // LunchDataRows = dsLunch.Tables[0].Select(dataFilter, dataSort); lvwListEmployee.BeginUpdate(); lvwListEmployee.TableModel.Rows.Clear(); int STT = 0; foreach (DataRow dr in dsEmployee.Tables[0].Rows) { string CardID = dr["CardID"].ToString(); string EmployeeName = dr["EmployeeName"].ToString(); string EmployeeID = dr["EmployeeID"].ToString(); Cell[] cells = new Cell[4]; cells[0] = new Cell(STT + 1); cells[1] = new Cell(CardID); cells[2] = new Cell(EmployeeName); cells[3] = new Cell(EmployeeID); Row row = new Row(cells); row.Tag = STT; lvwListEmployee.TableModel.Rows.Add(row); STT++; } lvwListEmployee.EndUpdate(); }
private void DeleteRow(Row row) { //DialogResult res = MessageBox.Show(String.Format("Do you really want to remove mask {0}?", row.Cells[0].Text), "Delete item", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); //if (res != DialogResult.OK) return; int index = row.Index; TableModel.Rows.RemoveAt(index); if (TableModel.Rows.Count <= index && index > 0) index--; TableModel.Selections.SelectCells(index, 0, index, 2); if (Changed != null) Changed(this, null); }
private void PopulateListInsuranInYear() { dsInsurance = insuranceDO.GetListInsuranceInYear(int.Parse(cboYear.Text)); lvwListInsurance.BeginUpdate(); lvwListInsurance.TableModel.Rows.Clear(); int STT = 0; foreach (DataRow dr in dsInsurance.Tables[0].Rows) { String StartDate = DateTime.Parse(dr["StartPointDate"].ToString()).ToString("dd/MM/yyyy"); String EndDate = DateTime.Parse(dr["EndPointDate"].ToString()).ToString("dd/MM/yyyy"); Cell[] listInusurance = new Cell[3]; listInusurance[0]= new Cell((STT+1).ToString()); listInusurance[1]= new Cell(StartDate); listInusurance[2]= new Cell(EndDate); Row row = new Row(listInusurance); row.Tag = STT; lvwListInsurance.TableModel.Rows.Add(row); STT ++; } lvwListInsurance.EndUpdate(); }
/// <summary> /// Initializes a new instance of the Row class with default settings and a parent row. The new row /// is a sub row /// </summary> public Row(Row parent) { this.Init(); this.parentrow = parent; }
public void VisualizeFilter(string mask, string info, bool local) { Row row = new Row(); Cell cell1 = new Cell(); CellStyle cellStyle1 = new CellStyle(); Cell cell2 = new Cell(); CellStyle cellStyle2 = new CellStyle(); cell1.Text = mask; cell1.Checked = !local; cell1.Icon = GetIconForMask(mask); cell1.Image = Properties.Resources.Information; // HACK: fake bitmap with same size as icon if (info.Length > 0) cell2.Text = info; else cell2.Text = GetInfoForMask(mask); cellStyle1.Font = new System.Drawing.Font("Courier", 8.00F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); if (globalMode) { cellStyle1.ForeColor = Color.Blue; } cell1.CellStyle = cellStyle1; cellStyle2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); cell2.CellStyle = cellStyle2; if (info.Length > 0) { cell2.ForeColor = Color.Black; } else { cell2.ForeColor = Color.Gray; } row.Cells.AddRange(new XPTable.Models.Cell[] { cell1, cell2 }); row.ChildIndex = 0; row.Editable = true; tableModel.Rows.Add(row); }
/// <summary> /// Adds the word. /// </summary> /// <param name="word">The word.</param> /// <remarks>Documented by Dev05, 2007-09-27</remarks> private void AddWord(string word) { if (checkBoxRemove.Checked) { Regex regEx = new Regex(@"[({\[].*[)}\]]"); word = regEx.Replace(word, ""); } position++; if (position >= tableCards.ColumnModel.Columns.Count || currentItem == null) { tableCards.GridLines = GridLines.Both; currentItem = new Row(); currentItem.Cells.Add(new Cell("x")); currentItem.Cells[0].CellStyle = new CellStyle(); currentItem.Cells[0].CellStyle.Padding = new CellPadding(0, 0, 0, 0); currentItem.Cells[0].CellStyle.Font = new Font(new FontFamily("Arial"), 8, FontStyle.Bold); position = 1; while (!tableCards.ColumnModel.Columns[position].Visible && position < tableCards.ColumnModel.Columns.Count) { tableCards.Invoke((emptyDelegate)delegate() { currentItem.Cells.Add(new Cell("")); }); position++; } currentItem.Cells.Add(new Cell(word)); tableCards.Invoke((emptyDelegate)delegate() { tableCards.TableModel.Rows.Add(currentItem); }); } else { while (!tableCards.ColumnModel.Columns[position].Visible && position < tableCards.ColumnModel.Columns.Count) { tableCards.Invoke((emptyDelegate)delegate() { currentItem.Cells.Add(new Cell("")); }); position++; } tableCards.Invoke((emptyDelegate)delegate() { currentItem.Cells.Add(new Cell(word)); }); } if (checkBoxBeep.Checked && position == lastVisibleColumn) Beep(); if (position == lastVisibleColumn) position = 50; tableCards.EnsureVisible(tableCards.TableModel.Rows.Count - 1, currentItem.Cells.Count - 1); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { XPTable.Models.Row row1 = new XPTable.Models.Row(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmListLeaveSchedule)); this.cboDepartment = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.dtpTo = new System.Windows.Forms.DateTimePicker(); this.dtpFrom = new System.Windows.Forms.DateTimePicker(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.dtgcCardID = new System.Windows.Forms.DataGridTextBoxColumn(); this.dtgcEmployeeName = new System.Windows.Forms.DataGridTextBoxColumn(); this.dtgcDepartment = new System.Windows.Forms.DataGridTextBoxColumn(); this.dtgcLeaveLocation = new System.Windows.Forms.DataGridTextBoxColumn(); this.dtgcWorkInfo = new System.Windows.Forms.DataGridTextBoxColumn(); this.dtgcStartLeave = new System.Windows.Forms.DataGridTextBoxColumn(); this.dtgcEndLeave = new System.Windows.Forms.DataGridTextBoxColumn(); this.tableModel1 = new XPTable.Models.TableModel(); this.columnModel1 = new XPTable.Models.ColumnModel(); this.cSTT = new XPTable.Models.NumberColumn(); this.chDepartment = new XPTable.Models.TextColumn(); this.chCardID = new XPTable.Models.TextColumn(); this.chEmployeeName = new XPTable.Models.TextColumn(); this.chStartLeave = new XPTable.Models.TextColumn(); this.EndLeave = new XPTable.Models.TextColumn(); this.chLeaveLocation = new XPTable.Models.TextColumn(); this.chWorkInfo = new XPTable.Models.TextColumn(); this.lvwLeaveSchedule = new XPTable.Models.Table(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.btnEdit = new System.Windows.Forms.Button(); this.btnDelete = new System.Windows.Forms.Button(); this.btnAdd = new System.Windows.Forms.Button(); this.btnView = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button(); this.btnExcel = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.lvwLeaveSchedule)).BeginInit(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // cboDepartment // this.cboDepartment.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.cboDepartment.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboDepartment.Location = new System.Drawing.Point(472, 16); this.cboDepartment.Name = "cboDepartment"; this.cboDepartment.Size = new System.Drawing.Size(224, 21); this.cboDepartment.TabIndex = 24; // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(408, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(64, 23); this.label1.TabIndex = 23; this.label1.Text = "Bộ phận"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // dtpTo // this.dtpTo.CustomFormat = "dd/MM/yyyy "; this.dtpTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dtpTo.Location = new System.Drawing.Point(224, 16); this.dtpTo.Name = "dtpTo"; this.dtpTo.Size = new System.Drawing.Size(88, 20); this.dtpTo.TabIndex = 20; this.dtpTo.CloseUp += new System.EventHandler(this.dtpTo_CloseUp); // // dtpFrom // this.dtpFrom.CustomFormat = "dd/MM/yyyy "; this.dtpFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dtpFrom.Location = new System.Drawing.Point(64, 16); this.dtpFrom.Name = "dtpFrom"; this.dtpFrom.Size = new System.Drawing.Size(88, 20); this.dtpFrom.TabIndex = 19; this.dtpFrom.CloseUp += new System.EventHandler(this.dtpFrom_CloseUp); // // label3 // this.label3.Location = new System.Drawing.Point(160, 16); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(64, 24); this.label3.TabIndex = 22; this.label3.Text = "Đến ngày"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.Location = new System.Drawing.Point(8, 16); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(56, 24); this.label2.TabIndex = 21; this.label2.Text = "Từ ngày"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // dtgcCardID // this.dtgcCardID.Format = ""; this.dtgcCardID.FormatInfo = null; this.dtgcCardID.HeaderText = "Mã thẻ"; this.dtgcCardID.MappingName = "CardID"; this.dtgcCardID.Width = 75; // // dtgcEmployeeName // this.dtgcEmployeeName.Format = ""; this.dtgcEmployeeName.FormatInfo = null; this.dtgcEmployeeName.HeaderText = "Tên nhân viên"; this.dtgcEmployeeName.MappingName = "EmployeeName"; this.dtgcEmployeeName.Width = 120; // // dtgcDepartment // this.dtgcDepartment.Format = ""; this.dtgcDepartment.FormatInfo = null; this.dtgcDepartment.HeaderText = "Phòng"; this.dtgcDepartment.MappingName = "DepartmentName"; this.dtgcDepartment.Width = 80; // // dtgcLeaveLocation // this.dtgcLeaveLocation.Format = ""; this.dtgcLeaveLocation.FormatInfo = null; this.dtgcLeaveLocation.HeaderText = "Nơi công tác"; this.dtgcLeaveLocation.MappingName = "LeaveLocation"; this.dtgcLeaveLocation.Width = 75; // // dtgcWorkInfo // this.dtgcWorkInfo.Format = ""; this.dtgcWorkInfo.FormatInfo = null; this.dtgcWorkInfo.HeaderText = "Công việc"; this.dtgcWorkInfo.MappingName = "WorkInfo"; this.dtgcWorkInfo.Width = 150; // // dtgcStartLeave // this.dtgcStartLeave.Format = ""; this.dtgcStartLeave.FormatInfo = null; this.dtgcStartLeave.HeaderText = "Ngày đi"; this.dtgcStartLeave.MappingName = "StartLeave"; this.dtgcStartLeave.Width = 75; // // dtgcEndLeave // this.dtgcEndLeave.Format = ""; this.dtgcEndLeave.FormatInfo = null; this.dtgcEndLeave.HeaderText = "Ngày về"; this.dtgcEndLeave.MappingName = "EndLeave"; this.dtgcEndLeave.Width = 75; // // tableModel1 // this.tableModel1.Rows.AddRange(new XPTable.Models.Row[] { row1 }); // // columnModel1 // this.columnModel1.Columns.AddRange(new XPTable.Models.Column[] { this.cSTT, this.chDepartment, this.chCardID, this.chEmployeeName, this.chStartLeave, this.EndLeave, this.chLeaveLocation, this.chWorkInfo }); // // cSTT // this.cSTT.Editable = false; this.cSTT.Text = "STT"; this.cSTT.Width = 40; // // chDepartment // this.chDepartment.Editable = false; this.chDepartment.Text = "Bộ phận"; this.chDepartment.Width = 100; // // chCardID // this.chCardID.Editable = false; this.chCardID.Text = "Mã thẻ"; this.chCardID.Width = 60; // // chEmployeeName // this.chEmployeeName.Editable = false; this.chEmployeeName.Text = "Tên nhân viên"; this.chEmployeeName.Width = 130; // // chStartLeave // this.chStartLeave.Editable = false; this.chStartLeave.Text = "Bắt đầu"; // // EndLeave // this.EndLeave.Editable = false; this.EndLeave.Text = "Kết thúc"; // // chLeaveLocation // this.chLeaveLocation.Editable = false; this.chLeaveLocation.Text = "Nơi công tác"; this.chLeaveLocation.Width = 90; // // chWorkInfo // this.chWorkInfo.Editable = false; this.chWorkInfo.Text = "Nội dung công việc"; this.chWorkInfo.Width = 140; // // lvwLeaveSchedule // this.lvwLeaveSchedule.AlternatingRowColor = System.Drawing.Color.FromArgb(((System.Byte)(230)), ((System.Byte)(237)), ((System.Byte)(245))); this.lvwLeaveSchedule.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lvwLeaveSchedule.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(237)), ((System.Byte)(242)), ((System.Byte)(249))); this.lvwLeaveSchedule.ColumnModel = this.columnModel1; this.lvwLeaveSchedule.EnableToolTips = true; this.lvwLeaveSchedule.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(14)), ((System.Byte)(66)), ((System.Byte)(121))); this.lvwLeaveSchedule.FullRowSelect = true; this.lvwLeaveSchedule.GridColor = System.Drawing.SystemColors.ControlDark; this.lvwLeaveSchedule.GridLines = XPTable.Models.GridLines.Both; this.lvwLeaveSchedule.GridLineStyle = XPTable.Models.GridLineStyle.Dot; this.lvwLeaveSchedule.HeaderFont = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.lvwLeaveSchedule.Location = new System.Drawing.Point(8, 16); this.lvwLeaveSchedule.Name = "lvwLeaveSchedule"; this.lvwLeaveSchedule.NoItemsText = WorkingContext.LangManager.GetString("XPtable"); this.lvwLeaveSchedule.SelectionBackColor = System.Drawing.Color.FromArgb(((System.Byte)(169)), ((System.Byte)(183)), ((System.Byte)(201))); this.lvwLeaveSchedule.SelectionForeColor = System.Drawing.Color.FromArgb(((System.Byte)(14)), ((System.Byte)(66)), ((System.Byte)(121))); this.lvwLeaveSchedule.SelectionStyle = XPTable.Models.SelectionStyle.Grid; this.lvwLeaveSchedule.Size = new System.Drawing.Size(688, 400); this.lvwLeaveSchedule.SortedColumnBackColor = System.Drawing.Color.Transparent; this.lvwLeaveSchedule.TabIndex = 30; this.lvwLeaveSchedule.TableModel = this.tableModel1; this.lvwLeaveSchedule.UnfocusedSelectionBackColor = System.Drawing.Color.FromArgb(((System.Byte)(201)), ((System.Byte)(210)), ((System.Byte)(221))); this.lvwLeaveSchedule.UnfocusedSelectionForeColor = System.Drawing.Color.FromArgb(((System.Byte)(14)), ((System.Byte)(66)), ((System.Byte)(121))); this.lvwLeaveSchedule.SelectionChanged += new XPTable.Events.SelectionEventHandler(this.lvwLeaveSchedule_SelectionChanged); this.lvwLeaveSchedule.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lvwLeaveSchedule_MouseDown); // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.lvwLeaveSchedule); this.groupBox1.Location = new System.Drawing.Point(8, 48); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(704, 424); this.groupBox1.TabIndex = 31; this.groupBox1.TabStop = false; // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.dtpTo); this.groupBox2.Controls.Add(this.dtpFrom); this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.label2); this.groupBox2.Controls.Add(this.label1); this.groupBox2.Controls.Add(this.cboDepartment); this.groupBox2.Location = new System.Drawing.Point(8, 0); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(704, 48); this.groupBox2.TabIndex = 32; this.groupBox2.TabStop = false; // // btnEdit // this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnEdit.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnEdit.Location = new System.Drawing.Point(472, 480); this.btnEdit.Name = "btnEdit"; this.btnEdit.TabIndex = 36; this.btnEdit.Text = "Sửa"; this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click); // // btnDelete // this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnDelete.Location = new System.Drawing.Point(552, 480); this.btnDelete.Name = "btnDelete"; this.btnDelete.TabIndex = 37; this.btnDelete.Text = "Xóa"; this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); // // btnAdd // this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnAdd.Location = new System.Drawing.Point(392, 480); this.btnAdd.Name = "btnAdd"; this.btnAdd.TabIndex = 35; this.btnAdd.Text = "Thêm"; this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); // // btnView // this.btnView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnView.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnView.Location = new System.Drawing.Point(8, 480); this.btnView.Name = "btnView"; this.btnView.TabIndex = 33; this.btnView.Text = "Xem"; this.btnView.Click += new System.EventHandler(this.btnView_Click); // // btnClose // this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnClose.Location = new System.Drawing.Point(632, 480); this.btnClose.Name = "btnClose"; this.btnClose.TabIndex = 34; this.btnClose.Text = "Đóng"; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // btnExcel // this.btnExcel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnExcel.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btnExcel.Location = new System.Drawing.Point(272, 480); this.btnExcel.Name = "btnExcel"; this.btnExcel.Size = new System.Drawing.Size(112, 23); this.btnExcel.TabIndex = 38; this.btnExcel.Text = "Xuất Excel"; this.btnExcel.Click += new System.EventHandler(this.btnExcel_Click); // // frmListLeaveSchedule // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(720, 510); this.Controls.Add(this.btnExcel); this.Controls.Add(this.btnEdit); this.Controls.Add(this.btnDelete); this.Controls.Add(this.btnAdd); this.Controls.Add(this.btnView); this.Controls.Add(this.btnClose); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "frmListLeaveSchedule"; this.Text = "Danh sách nhân viên đi công tác"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.ListLeaveSchedule_Load); ((System.ComponentModel.ISupportInitialize)(this.lvwLeaveSchedule)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); }
/// <summary> /// Replaces the Row at the specified index to the specified Row /// </summary> /// <param name="index">The index of the Row to be replaced</param> /// <param name="row">The Row to be placed at the specified index</param> internal void SetRow(int index, Row row) { if (index < 0 || index >= this.Count) { throw new ArgumentOutOfRangeException("value"); } if (row == null) { throw new ArgumentNullException("row cannot be null"); } this.List[index] = row; row.InternalIndex = index; }
/// <summary> /// Adds the line. /// </summary> /// <param name="line">The line.</param> /// <remarks>Documented by Dev05, 2007-09-27</remarks> private void AddLine(string line) { tableCards.GridLines = GridLines.Both; currentItem = null; position = 0; bool oldBeepValue = checkBoxBeep.Checked; checkBoxBeep.Checked = false; int i = 0; string[] words = line.Split(new char[] { '\t', ';' }); while (position <= 12 && i < words.Length) { AddWord(words[i]); i++; } checkBoxBeep.Checked = oldBeepValue; currentItem = null; }
/// <summary> /// Count the number of hidden rows before the supplied row. /// </summary> /// <param name="row">The row to count up to.</param> /// <returns>The number of hidden rows.</returns> internal int HiddenRowCountBefore(Row row) { return HiddenRowCountBefore(IndexOf(row)); }
void table_MouseClick(object sender, MouseEventArgs ev) { int rindex = table.RowIndexAt(ev.X, ev.Y); if (rindex < 0) { return; } if (rindex >= table.TableModel.Rows.Count) { return; } XPTable.Models.Row row = table.TableModel.Rows[rindex]; if (row.Parent != null) { return; } LogEvent e = row.Tag as LogEvent; if (row.SubRows.Count > 0) { int index = row.Index + 1; while (true) { if (table.TableModel.Rows.Count <= index) { break; } XPTable.Models.Row xrow = table.TableModel.Rows[index]; if (xrow.ChildIndex == 0) { break; } table.TableModel.Rows.Remove(xrow); } row.SubRows.Clear(); } else { foreach (Pair <Bitmap, string> line in e.lines) { XPTable.Models.Row subrow = new XPTable.Models.Row(); XPTable.Models.Cell subcell1 = new XPTable.Models.Cell(); XPTable.Models.CellStyle subcellStyle1 = new XPTable.Models.CellStyle(); XPTable.Models.Cell subcell2 = new XPTable.Models.Cell(); XPTable.Models.CellStyle subcellStyle2 = new XPTable.Models.CellStyle(); subcell2.Image = line.First; subcell2.Text = line.Second; subcell2.ColSpan = 2; subcell2.ForeColor = Color.Gray; subrow.Cells.Add(subcell1); subrow.Cells.Add(subcell2); subrow.Editable = false; row.SubRows.Add(subrow); } } }
/// <summary> /// Removes the specified Row from the selection /// </summary> /// <param name="row">The Row to be removed from the selection</param> internal void RemoveRow(Row row) { if (this.rows.Contains(row)) { int[] oldSelectedIndicies = this.SelectedIndicies; this.rows.Remove(row); this.owner.OnSelectionChanged(new SelectionEventArgs(this.owner, oldSelectedIndicies, this.SelectedIndicies)); } }
private void PopulatePositionListView() { dsPosition = departmentDO.GetAllHospitals(); lvwPosition.BeginUpdate(); lvwPosition.TableModel.Rows.Clear(); dtPosition = dsPosition.Tables[0]; if (dtPosition.Rows.Count > 0) { // selectedRowIndex = 0; int STT = 0; foreach (DataRow dr in dtPosition.Rows) { STT++; string PositionName = dr["HospitalName"].ToString(); string PositionShortName = dr["HospitalID"].ToString(); string Description = dr["HospitalAddress"].ToString(); Row row = new Row(new string[] { STT.ToString(), PositionName, PositionShortName, Description }); row.Tag = STT - 1; this.lvwPosition.TableModel.Rows.Add(row); } } lvwPosition.EndUpdate(); }
/// <summary> /// Hiển thị danh sách nhân viên trong công ty/phòng ban /// </summary> private void PopulateEmployeeListView() { dsEmployee = employeeDO.GetEmployeeByDepartment(1); lvwEmployee.BeginUpdate(); foreach (DataRow dr in dsEmployee.Tables[0].Rows) { string CardID = dr["CardID"].ToString(); string EmployeeName = dr["EmployeeName"].ToString(); string DepartmentName= dr["DepartmentName"].ToString(); Row xpRow = new Row(new string[] {DepartmentName,CardID, EmployeeName}); lvwEmployee.TableModel.Rows.Add(xpRow); } lvwEmployee.EndUpdate(); }
/// <summary> /// Inserts an array of Rows into the collection at the specified /// index /// </summary> /// <param name="index">The zero-based index at which the rows /// should be inserted</param> /// <param name="rows">The array of Rows to be inserted into /// the collection</param> public void InsertRange(int index, Row[] rows) { if (rows == null) { throw new System.ArgumentNullException("Row[] is null"); } if (index < 0) { throw new IndexOutOfRangeException(); } if (index >= this.Count) { this.AddRange(rows); } else { for (int i=rows.Length-1; i>=0; i--) { this.Insert(index, rows[i]); } } }
/// <summary> /// Inserts a Row into the collection at the specified index /// </summary> /// <param name="index">The zero-based index at which the Row /// should be inserted</param> /// <param name="row">The Row to insert</param> public void Insert(int index, Row row) { if (row == null) { return; } if (index < 0) { throw new IndexOutOfRangeException(); } if (index >= this.Count) { this.Add(row); } else { base.List.Insert(index, row); if (owner != null) this.owner.OnRowAdded(new TableModelEventArgs(this.owner, row, index, index)); else if (rowowner != null) { RowEventArgs args = new RowEventArgs(row, RowEventType.SubRowAdded, rowowner); args.SetRowIndex(index); this.OnRowAdded(args); } } }
/// <summary> /// /// </summary> private void PopulatePunishCardView() { dsPunishCard = punishCarDO.GetPunishCard(); lvwPunishCard.BeginUpdate(); lvwPunishCard.TableModel.Rows.Clear(); dtPunishCard = dsPunishCard.Tables[0]; int STT = 0; foreach (DataRow dr in dtPunishCard.Rows) { string CardName = dr["CardName"].ToString(); string PunishFactor = dr["PunishFactor"].ToString()+ " %"; string Note = dr["Note"].ToString(); Row row = new Row(new string[]{(STT+1).ToString(),CardName, PunishFactor, Note}); row.Tag = STT; lvwPunishCard.TableModel.Rows.Add(row); STT++; } lvwPunishCard.EndUpdate(); }
/// <summary> /// Removes the specified Row from the model /// </summary> /// <param name="row">The Row to remove</param> public void Remove(Row row) { int rowIndex = this.IndexOf(row); if (rowIndex != -1) { this.RemoveAt(rowIndex); } }
/// <summary> /// Initializes a new instance of the TableModel class with an array of Row objects /// </summary> /// <param name="rows">An array of Row objects that represent the Rows /// of the TableModel</param> public TableModel(Row[] rows) { if (rows == null) { throw new ArgumentNullException("rows", "Row[] cannot be null"); } this.Init(); if (rows.Length > 0) { this.Rows.AddRange(rows); } }
/// <summary> /// Removes an array of Row objects from the collection /// </summary> /// <param name="rows">An array of Row objects to remove /// from the collection</param> public void RemoveRange(Row[] rows) { if (rows == null) { throw new System.ArgumentNullException("Row[] is null"); } for (int i=0; i<rows.Length; i++) { this.Remove(rows[i]); } }