Пример #1
0
        } //FindNewProperties()

        //
        //
        //
        //
        private void AddRows()
        {
            // Assume that we add all Fills one for each row, in order of their listing.
            int rowID = activeGrid1.Items.Count;

            this.activeGrid1.SuspendLayout();
            while (rowID < m_Fills.Count)
            {
                // Create a new row
                SKACERO.ActiveRow aRow = new SKACERO.ActiveRow();
                aRow.Name = rowID.ToString();
                aRow.Text = rowID.ToString();
                for (int i = 1; i < this.activeGrid1.Columns.Count; i++)
                {
                    SKACERO.ActiveRow.ActiveCell cell = new SKACERO.ActiveRow.ActiveCell(aRow, String.Empty);
                    cell.Name         = String.Format("{0}_{1}", rowID, this.activeGrid1.Columns[i].Name);
                    cell.DecimalValue = Decimal.Zero;
                    cell.PreTextFont  = new Font("Arial", cell.Font.Size);
                    cell.PostTextFont = new Font("Arial", cell.Font.Size);
                    aRow.SubItems.Add(cell);
                }
                //
                // Update values
                //
                for (int i = 0; i < m_PropertyNames.Count; ++i)
                {
                    string       propertyName = m_PropertyNames[i];
                    object       o            = m_Fills[rowID];
                    PropertyInfo propertyInfo = m_Fills[rowID].GetType().GetProperty(propertyName);
                    //if (propertyInfo == null && m_Fills[rowID].FillDetails!=null)
                    //{
                    //    o = m_Fills[rowID].FillDetails;
                    //    propertyInfo = o.GetType().GetProperty(propertyName);           // Property may belong to FillDetails.
                    //}
                    if (o != null && propertyInfo != null)
                    {
                        object value    = propertyInfo.GetValue(o);
                        string cellName = String.Format("{0}_{1}", rowID, propertyName);
                        SKACERO.ActiveRow.ActiveCell cell = aRow.SubItems[cellName];
                        cell.Text = string.Format(m_PropertyFormat[i], value);
                    }
                }

                //
                this.activeGrid1.Items.Add(aRow);
                rowID++;
            }
            this.activeGrid1.ResumeLayout();
        }//
Пример #2
0
        /// <summary>
        /// Creates the rows in the data-grid
        /// </summary>
        private void PopulateRows()
        {
            // This is essential as it will prevent the 'flashing' functionality
            // from being triggered while the grid is being initialised.
            this.lvBalances.SuspendLayout();

            // Create a list to hold all of the row items.
            List <SKACERO.ActiveRow> items = new List <SKACERO.ActiveRow>(20);

            foreach (string ccy in this.currencies)
            {
                // Create a new row.
                SKACERO.ActiveRow item = new SKACERO.ActiveRow();
                item.Text = ccy;
                item.Name = ccy;

                // Add the cells to the row, one for each column.
                // N.B. Starting from column ONE not column ZERO as this is
                //      reserved for the row header.
                for (int i = 1; i < this.lvBalances.Columns.Count; i++)
                {
                    SKACERO.ActiveRow.ActiveCell cell = new SKACERO.ActiveRow.ActiveCell(item, String.Empty);
                    cell.Name         = String.Format("{0}_{1}", ccy, this.lvBalances.Columns[i].Name);
                    cell.DecimalValue = Decimal.Zero;
                    cell.PreTextFont  = new Font("Arial", cell.Font.Size);
                    cell.PostTextFont = new Font("Arial", cell.Font.Size);
                    item.SubItems.Add(cell);
                }

                items.Add(item);
            }

            // Add all of the rows to the list view.
            this.lvBalances.Items.AddRange(items.ToArray());

            this.lvBalances.ResumeLayout();
        }