Ejemplo n.º 1
0
        private void InitializeRows()
        {
            #region BuildGrid

            // add rows, add SaleGridRow
            this.SuspendLayout();
            this.pnlContainer.SuspendLayout();
            this.pnlContainer.Controls.Clear();

            for (int i = 0; i < RowCount; i++)
            {
                var row = new SaleGridRow()
                {
                    Top         = i * RowHeight,
                    GridControl = this,
                    Width       = this.pnlContainer.Width,
                    Height      = RowHeight,
                    Parent      = this.pnlContainer
                };
                row.Click += new EventHandler(row_Clicked);
                this.pnlContainer.Controls.Add(row);
                m_rows.Add(row);
            }

            this.pnlContainer.ResumeLayout();
            this.ResumeLayout();

            #endregion
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Update data for row only
 /// </summary>
 /// <param name="row"></param>
 /// <param name="itemData"></param>
 public void SetRowData(SaleGridRow row, object itemData)
 {
     if (row.RowIndex.InRange(0, m_dataRows.Count))
     {
         m_dataRows[row.RowIndex] = itemData;
     }
     row.ItemData = itemData;
 }
Ejemplo n.º 3
0
        private void BuildRows()
        {
            foreach (Control c in this.pnlContainer.Controls)
            {
                SaleGridRow row = c as SaleGridRow;
                row.ColumnWidths = gridHeader1.ColumnWidths;

                // InitializeRow event
                if (InitializeRow != null)
                {
                    InitializeRow(new RowDataBoundEventArgs()
                    {
                        Row = row
                    });
                }

                // if there is nothing doing with row,
                // make cells and fire InitializeCell event
                if (row.Controls.Count == 0 && ColumnCount > 0)
                {
                    #region Render cells

                    int left = 0;
                    for (int j = 0; j < gridHeader1.ColumnWidths.Length; j++)
                    {
                        SaleGridCell cell = new SaleGridCell()
                        {
                            Width  = gridHeader1.ColumnWidths[j],
                            Height = RowHeight - 2,
                            Left   = left,
                            Top    = 1,
                            Parent = row
                        };

                        row.Controls.Add(cell);
                        if (InitializeCell != null)
                        {
                            InitializeCell(new CellDataBoundEventArgs()
                            {
                                Cell = cell
                            });
                        }

                        left += gridHeader1.ColumnWidths[j];
                    }

                    row.HasCell = true;

                    #endregion
                }

                if (!UnSelectable)
                {
                    row.ForwareClickEvents();
                }
            }
        }
Ejemplo n.º 4
0
        void GridPanel_Resize(object sender, EventArgs e)
        {
            this.SuspendLayout();
            this.pnlContainer.SuspendLayout();
            for (int i = 0; i < this.pnlContainer.Controls.Count; i++)
            {
                // add Grid row
                SaleGridRow row = (SaleGridRow)this.pnlContainer.Controls[i];
                row.Top    = i * RowHeight;
                row.Height = RowHeight;
                row.Width  = this.pnlContainer.Width;
            }

            this.pnlContainer.ResumeLayout();
            this.ResumeLayout();
        }
Ejemplo n.º 5
0
        void row_Clicked(object sender, EventArgs e)
        {
            SaleGridRow row = (SaleGridRow)sender;

            if (row.IsEmpty)
            {
                return;
            }

            if (DisableSelection)
            {
                return;
            }

            //SelectedVisibleIndex = row.VisibleIndex;
            SelectedRowIndex = row.RowIndex;
            if (RowClicked != null)
            {
                RowClicked(this, e);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Find events
        /// </summary>
        /// <param name="row"></param>
        /// <param name="userStates"></param>
        private void FireRowEvent(SaleGridRow row, object itemData)
        {
            if (RowDataBound != null)
            {
                var e = new RowDataBoundEventArgs()
                {
                    Row      = row,
                    ItemData = itemData
                };
                RowDataBound(e);
                if (!e.CancelSet)
                {
                    row.ItemData = itemData;
                }
            }

            if (row.HasCell)
            {
                if (CellDataBound != null)
                {
                    foreach (SaleGridCell cell in row.Cells)
                    {
                        var e = new CellDataBoundEventArgs()
                        {
                            Cell     = cell,
                            ItemData = itemData
                        };

                        CellDataBound(e);

                        if (!e.CancelSet)
                        {
                            row.ItemData = itemData;
                        }
                    }
                }
            }
        }