示例#1
0
 private void btnNew_Click(object sender, System.EventArgs e)
 {
     if (this.comboBox1.SelectedItem == null)
     {
         MessageBox.Show("Select a field");
     }
     else
     {
         string descName = this.comboBox1.SelectedItem.ToString();
         bool   flag     = false;
         foreach (GridColumnDescriptor des in descColl)
         {
             if (des.Name.CompareTo(descName) == 0)
             {
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             GridColumnDescriptor desc1 = new GridColumnDescriptor(descName);
             descColl.Add(desc1);
             this.listBox1.Items.Add(desc1.Name);
         }
         else
         {
             MessageBox.Show("Selected Field has already been added");
         }
     }
 }
        /// <summary>
        /// Adds tree node support to a GridGroupingControl whose datasource is a DataTable with
        /// a self-reference.
        /// </summary>
        /// <param name="grid">The GridGroupingControl.</param>
        /// <param name="dataSource">The DataTable with a column that references to primary key values for the same DataTable. This means there is a field that refers to another DataRow in the same DataTable.</param>
        /// <param name="selfReferenceColumn">The is the name of the column that refers to the primary key value that identifies another DataRow in the DataTabale.</param>
        /// <param name="idColumn">The primary key column for the DataTable.</param>
        /// <param name="nodeColumn">The name of the column that should appear in the +/- expansion cell.</param>
        /// <returns>An accessor object (generally for internal use) that maps rowindexes to tree node objects.</returns>
        public SelfReferenceDataSourceAccessor WireSelfReferenceGrid(GridGroupingControl grid, DataTable dataSource, string selfReferenceColumn, string idColumn, string nodeColumn)
        {
            this.rowIndexer = new NodeArray(dataSource.DefaultView);
            this.grid       = grid;
            this.grid.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
            this.grid.TopLevelGroupOptions.ShowCaption = false;
            this.selfReferenceProperty = selfReferenceColumn;
            this.idProperty            = idColumn;
            this.nodeProperty          = nodeColumn;

            this.accessor        = new SelfReferenceDataSourceAccessor(dataSource, selfReferenceColumn, idColumn);
            this.grid.DataSource = this.rowIndexer;// accessor.GetRootDataView();
            WireGrid(grid, accessor.GetRootDataView(), accessor);

            //make sure nodeColumn is the first one...
            GridColumnDescriptor gbc = grid.TableDescriptor.Columns[nodeColumn];

            if (gbc == null)
            {
                throw new Exception(string.Format("{0} is missing from the grid.", nodeColumn));
            }
            int loc = grid.TableDescriptor.Columns.IndexOf(gbc);

            if (loc != 0)
            {
                grid.TableDescriptor.Columns.Move(loc, 0);
            }
            foreach (GridColumnDescriptor cd in grid.TableDescriptor.Columns)
            {
                cd.AllowSort = false;
            }
            return(accessor);
        }
示例#3
0
        /// <summary>
        /// Adds the delete button to the specified column. TableControlPushButtonClick event should be handled to catch user click.
        /// </summary>
        public void AddDeleteButton(GridColumnDescriptor cmn)
        {
            cmn.Width = 20;
            var style = cmn.Appearance.AnyRecordFieldCell;

            style.CellType    = GridCellTypeName.PushButton;
            style.Description = " X ";
        }
示例#4
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            if (DpiAware.GetCurrentDpi() > 96)
            {
                this.CaptionBarHeight = (int)DpiAware.LogicalToDeviceUnits(this.CaptionBarHeight);
            }
            gridGroupingControl1 = new GridGroupingControl();
            // now assign the datasource
            gridGroupingControl1.DataSource = table;
            SampleCustomization();
            GridSettings();

            Console.WriteLine(GridPropertyTypeDefaultStyleCollection.Default["System.Boolean"].Style);

            // enable/disable UITYpeEditors for boolean cells only and show checkbox instead.
            bool displayCheckBoxForBooleanFields = false;

            if (displayCheckBoxForBooleanFields)
            {
                GridPropertyTypeDefaultStyle booleanDefault = this.gridGroupingControl1.Engine.PropertyTypeDefaultStyles["System.Boolean"];
                booleanDefault.AllowDropDown = false;
            }

            #region Sample code to get the row and column index
            // Sample code to get the row and column index in the grid for a column (works also
            // if column sets with multiple rows are specified).
            bool useOldCodeToGetCellInfo = false;
            if (useOldCodeToGetCellInfo)
            {
                GridColumnDescriptor cd = this.gridGroupingControl1.TableDescriptor.Columns["Boolean"];
                int relativeRowIndex, colIndex;
                this.gridGroupingControl1.TableDescriptor.ColumnToRowColIndex(cd.MappingName, out relativeRowIndex, out colIndex);

                Record r = this.gridGroupingControl1.Table.Records[0];
                int    recordRowIndex = this.gridGroupingControl1.Table.DisplayElements.IndexOf(r);

                int rowIndex = recordRowIndex + relativeRowIndex;
                GridTableCellStyleInfo style = this.gridGroupingControl1.Table.GetTableCellStyle(rowIndex, colIndex + this.gridGroupingControl1.TableDescriptor.GetColumnIndentCount());

                Console.WriteLine(style.TableCellIdentity.ToString());
                Console.WriteLine(style.ToString());
            }
            else
            {
                // Newer code using new GetTableCellStyle overloads after version 3.0.0.16
                Record r = this.gridGroupingControl1.Table.Records[0];
                GridTableCellStyleInfo style = this.gridGroupingControl1.Table.GetTableCellStyle(r, "Boolean");

                Console.WriteLine(style.TableCellIdentity.ToString());
                Console.WriteLine(style.ToString());
            }
            #endregion
        }
示例#5
0
        public void AddComboBox(GridColumnDescriptor cmn, object items)
        {
            var style = cmn.Appearance.AnyRecordFieldCell;

            style.CellType            = GridCellTypeName.ComboBox;
            style.DisplayMember       = "Text";
            style.ValueMember         = "Value";
            style.DataSource          = items;
            style.ExclusiveChoiceList = false;
            style.DropDownStyle       = GridDropDownStyle.Exclusive;
        }
示例#6
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     foreach (GridColumnDescriptor des in descColl)
     {
         if (des != null)
         {
             GridColumnDescriptor temp = groupingGrid.TableDescriptor.Columns.FindByMappingName(des.Name);
             temp.Appearance.AnyRecordFieldCell = des.Appearance.AnyRecordFieldCell;
         }
     }
 }
示例#7
0
 public IGridGroupOptionsSource GetParentGroupOptionsSource()
 {
     if (this.CategoryColumns.Count > 0)
     {
         GridColumnDescriptor column = ((GridTableDescriptor)this.ParentTableDescriptor).Columns[this.CategoryColumns[0].Name];
         if (column != null)
         {
             return(column);
         }
     }
     return((IGridGroupOptionsSource)this.ParentTableDescriptor);
 }
示例#8
0
 private void radioButton3_CheckedChanged(object sender, System.EventArgs e)
 {
     if (this.listBox1.SelectedItem != null)
     {
         string temp = this.listBox1.SelectedItem.ToString();
         GridColumnDescriptor tDesc = descColl[temp];
         if (radioButton3.Checked)
         {
             tDesc.Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Right;
         }
     }
 }
示例#9
0
        private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
        {
            GridGroupingControl groupingControl = (GridGroupingControl)sender;
            Element             el = e.TableCellIdentity.DisplayElement;

            e.Style.CellTipText = el.GetType().Name + (el.ParentElement != null ? " (Parent: " + el.ParentElement.GetType().Name + ")" : "");

            if (el is ExtraSection)
            {
                if (e.Style.TableCellIdentity.ColIndex == 0)
                {
                    // Row Header
                    e.Style.CellType = ((GridTableDescriptor)el.ParentTableDescriptor).Appearance.RecordRowHeaderCell.CellType;

                    if (el == el.ParentTable.CurrentElement)
                    {
                        e.Style.Text = "#";
                    }
                }
                else if (e.Style.TableCellIdentity.ColIndex <= el.GroupLevel)
                {
                    // Group Indent
                    e.Style.BackColor = Color.FromArgb(218, 229, 245);
                }
                else if (e.Style.TableCellIdentity.ColIndex <= extraSectionCoverCols + el.ParentTableDescriptor.GroupedColumns.Count)
                {
                    // Covered area (see TableModel_QueryCoveredRange above)
                    e.Style.BackColor = Color.FromArgb(192, 201, 219);
                    e.Style.CellValue = "ExtraSection (" + el.ParentGroup.Name + ")";
                }
                else if (e.Style.TableCellIdentity.ColIndex > 3)
                {
                    e.Style.BackColor = Color.FromArgb(252, 172, 38);
                    // you can get the column as follows:
                    GridTable            table  = (GridTable)el.ParentTable;
                    GridTableDescriptor  td     = e.TableCellIdentity.Table.TableDescriptor;
                    GridColumnDescriptor column = td.RecordRowColumns[0, e.Style.TableCellIdentity.ColIndex - el.ParentTableDescriptor.GroupedColumns.Count - 1];
                    e.Style.CellValue = column.Name;

                    // Using that column you could try and identify the summary that should be displayed in this cell.
                    if (column.MappingName == "Freight")
                    {
                        // Calling this method to demonstrate different alternatives to get to the summary text
                        e.Style.Text = GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage");

                        // Easier is to simple call built-in routine:
                        e.Style.Text = GridEngine.GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage");
                    }
                }
            }
        }
示例#10
0
 private void checkBox3_CheckedChanged(object sender, System.EventArgs e)
 {
     if (this.listBox1.SelectedItem != null)
     {
         string temp = this.listBox1.SelectedItem.ToString();
         GridColumnDescriptor tDesc = descColl[temp];
         if (checkBox3.Checked)
         {
             tDesc.Appearance.AnyRecordFieldCell.Font.Underline = true;
         }
         else
         {
             tDesc.Appearance.AnyRecordFieldCell.Font.Underline = false;
         }
     }
 }
示例#11
0
        /// <summary>
        /// A method that returns the filter values.
        /// </summary>
        /// <param name="column">Column in which filter is being applied.</param>
        /// <returns>Set of filter values.</returns>
        private object[] GetFilterValues(GridColumnDescriptor column)
        {
            var sd = new SummaryDescriptor(
                column.Name + "FilterBarChoices",
                column.MappingName,
                FilterBarChoicesSummary.CreateSummaryMethod)
            {
                IgnoreRecordFilterCriteria = true
            };

            if (!_engine.Table.TableDescriptor.Summaries.Contains(sd.Name))
            {
                _engine.Table.TableDescriptor.Summaries.Add(sd);
            }
            var summaries     = _engine.Table.GetSummaries();
            var summaryIndex  = _engine.Table.TableDescriptor.Summaries.IndexOf(sd);
            var filtersummary = (FilterBarChoicesSummary)summaries[summaryIndex];
            var values        = filtersummary.Values;

            _engine.Table.TableDescriptor.Summaries.Remove(sd);
            _engine.Table.SummariesDirty = true;
            return(values);
        }
示例#12
0
        public ContactsPaneForm()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            #region Settings

            ds = new DataSet();
            ReadXml(ds, "data.xml");
            this.gridGroupingControl1.DataSource = ds.Tables[0];
            this.gridGroupingControl1.TableModel.Properties.Buttons3D  = false;
            this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false;
            this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails    = false;
            this.gridGroupingControl1.NestedTableGroupOptions.ShowAddNewRecordBeforeDetails = false;
            this.gridGroupingControl1.ChildGroupOptions.ShowAddNewRecordBeforeDetails       = false;
            this.gridGroupingControl1.TableModel.Properties.RowHeaders = false;
            this.gridGroupingControl1.TableModel.TableStyle.BackColor  = SystemColors.HighlightText;
            this.gridGroupingControl1.Appearance.GroupCaptionPlusMinusCell.BorderMargins.Top = 12;
            this.gridGroupingControl1.Appearance.GroupCaptionPlusMinusCell.CellType          = "Image";
            this.gridGroupingControl1.Appearance.GroupCaptionPlusMinusCell.CellValue         = Image.FromFile(Syncfusion.Windows.Forms.WinFormsUtils.FindFile("res", "minus.png"));
            this.gridGroupingControl1.DefaultAppearance.AnyRecordFieldCell.Borders.Bottom    = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(227, 239, 255), GridBorderWeight.ExtraThin);
            this.gridGroupingControl1.DefaultAppearance.AnyRecordFieldCell.Borders.Right     = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(227, 239, 255), GridBorderWeight.ExtraThin);
            this.gridGroupingControl1.Appearance.GroupIndentCell.Borders.Bottom = new Syncfusion.Windows.Forms.Grid.GridBorder(Syncfusion.Windows.Forms.Grid.GridBorderStyle.Solid, Color.FromArgb(227, 239, 255), Syncfusion.Windows.Forms.Grid.GridBorderWeight.ExtraThin);
            this.gridGroupingControl1.TableOptions.CaptionRowHeight             = 30;
            this.gridGroupingControl1.TableOptions.ColumnHeaderRowHeight        = 22;
            this.gridGroupingControl1.TableOptions.IndentWidth          = 20;
            this.gridGroupingControl1.TableModel.TableStyle.Trimming    = StringTrimming.EllipsisCharacter;
            this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;
            this.gridGroupingControl1.TableOptions.RecordRowHeight      = 20;

            GridColumnDescriptor unboundCol = new GridColumnDescriptor("ImageCol", "", "", true, 30);
            unboundCol.Appearance.AnyRecordFieldCell.CellType  = "Image";
            unboundCol.Appearance.AnyRecordFieldCell.CellValue = Image.FromFile(Syncfusion.Windows.Forms.WinFormsUtils.FindFile("res", "contact.gif"));
            this.gridGroupingControl1.TableDescriptor.Columns.Add(unboundCol);

            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Clear();
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("ImageCol");
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("ContactID");
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("CompanyName");
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("ContactTitle");
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("Address");
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("City");
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("Phone");
            this.gridGroupingControl1.QueryCellStyleInfo     += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
            this.gridGroupingControl1.TableControl.MouseDown += new MouseEventHandler(TableControl_MouseDown);
            this.gridGroupingControl1.GroupCollapsed         += new GroupEventHandler(gridGroupingControl1_GroupCollapsed);
            this.gridGroupingControl1.GroupExpanded          += new GroupEventHandler(gridGroupingControl1_GroupExpanded);
            this.gridGroupingControl1.TableControlCellClick  += new GridTableControlCellClickEventHandler(gridGroupingControl1_TableControlCellClick);
            this.gridGroupingControl1.TableDescriptor.GroupedColumns.Changed += new Syncfusion.Collections.ListPropertyChangedEventHandler(GroupedColumns_Changed);

            visibleCols = new string[this.gridGroupingControl1.TableDescriptor.VisibleColumns.Count];
            for (int i = 0; i < visibleCols.Length; i++)
            {
                visibleCols[i] = this.gridGroupingControl1.TableDescriptor.VisibleColumns[i].Name;
            }

            this.gridGroupingControl1.GridGroupDropArea.BackColor     = Color.FromArgb(227, 239, 255);
            this.gridGroupingControl1.GridGroupDropArea.ThemesEnabled = false;
            this.gridGroupingControl1.GroupDropPanel.BackColor        = Color.FromArgb(227, 239, 255);
            this.gridGroupingControl1.Splitter.BackColor = Color.FromArgb(227, 239, 255);
            #endregion

            #region Events Subscribed
            this.gridGroupingControl1.TableDescriptor.VisibleColumns.Changed += new Syncfusion.Collections.ListPropertyChangedEventHandler(VisibleColumns_Changed);
            this.gridGroupingControl1.GridGroupDropArea.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(GridGroupDropArea_PrepareViewStyleInfo);
            this.gridGroupingControl1.TableControlCellDrawn += new GridTableControlDrawCellEventHandler(gridGroupingControl1_TableControlCellDrawn);
            #endregion
        }
示例#13
0
 /// <summary>
 /// Adds combobox to particular column of the grid.
 /// </summary>
 /// <remarks>http ://stackoverflow.com/questions/29750570/setting-row-specific-content-for-a-combobox-in-a-gridgroupingcontrol-cell</remarks>
 public void AddComboBox(GridColumnDescriptor cmn, IEnumerable <GridComboItem> items)
 {
     AddComboBox(cmn, (object)items);
 }
示例#14
0
        /// <summary>
        /// CustomSummary sample Customizations
        /// </summary>
        private void SampleCustomization()
        {
            // Setup a integrated summary
            GridSummaryColumnDescriptor sd0 = new GridSummaryColumnDescriptor();

            //sd0.Name = "QuantityAvg";
            sd0.DataMember    = "Quantity";
            sd0.DisplayColumn = "Quantity";
            sd0.Format        = "{Average:#.00}";
            sd0.SummaryType   = SummaryType.DoubleAggregate;
            this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Row 0", "Average", sd0));

            // Setup custom summaries
            this.gridGroupingControl1.QueryCustomSummary += new GridQueryCustomSummaryEventHandler(gridGroupingControl1_QueryCustomSummary);

            GridSummaryColumnDescriptor sd1 = new GridSummaryColumnDescriptor();

            sd1.Name          = "QuantityTotal";
            sd1.DataMember    = "Quantity";
            sd1.DisplayColumn = "Quantity";
            sd1.Format        = "{Total}";
            sd1.SummaryType   = SummaryType.Custom;
            this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Row 1", "Total", sd1));

            GridSummaryColumnDescriptor sd2 = new GridSummaryColumnDescriptor();

            sd2.Name          = "QuantityDistinctCount";
            sd2.DataMember    = "Quantity";
            sd2.DisplayColumn = "Quantity";
            sd2.Format        = "{Count}";
            sd2.SummaryType   = SummaryType.Custom;
            this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Row 2", "DistinctCount", sd2));


            GridSummaryColumnDescriptor sd3 = new GridSummaryColumnDescriptor();

            sd3.Name          = "QuantityMedian";
            sd3.DataMember    = "Quantity";
            sd3.DisplayColumn = "Quantity";
            sd3.Format        = "{Median}";
            sd3.SummaryType   = SummaryType.Custom;
            this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Row 3", "Statistic Median", sd3));


            // Setup running totals by displaying the value of a custom counter in an unbound field
            FieldDescriptor unboundField = new FieldDescriptor("QuantityCount", "", false, "");

            unboundField.ReadOnly = false;
            this.gridGroupingControl1.TableDescriptor.UnboundFields.Add(unboundField);

            // Routine that queries for the value
            this.gridGroupingControl1.TableDescriptor.QueryValue += new FieldValueEventHandler(unboundField_QueryValue);
            this.gridGroupingControl1.TableDescriptor.SaveValue  += new FieldValueEventHandler(unboundField_SaveValue);

            FieldDescriptor unboundField2 = new FieldDescriptor("QuantityCount2", "", false, "");

            this.gridGroupingControl1.TableDescriptor.UnboundFields.Add(unboundField2);

            this.gridGroupingControl1.TableDescriptor.Columns.IsModified = true;

            Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor gridColumnDescriptor1 = new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor();
            Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor gridColumnDescriptor2 = new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor();
            gridColumnDescriptor1.MappingName = "OrderID";
            this.gridGroupingControl1.TableDescriptor.Columns.AddRange(new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor[] {
                gridColumnDescriptor1,
                new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor("ProductID"),
                new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor("UnitPrice"),
                new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor("Quantity"),
            });

            foreach (GridColumnDescriptor col in this.gridGroupingControl1.TableDescriptor.Columns)
            {
                Regex  rex   = new Regex(@"\p{Lu}");
                int    index = rex.Match(col.MappingName.Substring(1)).Index;
                string name  = "";
                while (index > 0)
                {
                    name += col.MappingName.Substring(0, index + 1) + " ";
                    string secondName = col.MappingName.Substring(index + 1);
                    index = rex.Match(secondName.Substring(1)).Index;
                    while (index > 0)
                    {
                        name += secondName.Substring(0, index + 1) + " ";
                        index = rex.Match(col.MappingName.Substring(name.Replace(" ", "").Length).Substring(1)).Index;
                    }
                }
                name          += col.MappingName.Substring(name.Replace(" ", "").Length);
                col.HeaderText = name;
            }
            GridColumnDescriptor columnDescriptor = new GridColumnDescriptor(unboundField);

            columnDescriptor.HeaderText = "Quantity Count";
            columnDescriptor.Appearance.AnyRecordFieldCell.Interior = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(245)), ((System.Byte)(227))));
            this.gridGroupingControl1.TableDescriptor.Columns.Add(columnDescriptor);

            GridColumnDescriptor columnDescriptor2 = new GridColumnDescriptor(unboundField2);

            columnDescriptor2.HeaderText = "Quantity Count 2";
            columnDescriptor2.Appearance.AnyRecordFieldCell.Interior = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(245)), ((System.Byte)(227))));
            this.gridGroupingControl1.TableDescriptor.Columns.Add(columnDescriptor2);

            // Setup custom counter
            this.gridGroupingControl1.Table.QueryCustomCount     += new CustomCountEventHandler(Table_QueryCustomCount);
            this.gridGroupingControl1.CurrentRecordContextChange += new CurrentRecordContextChangeEventHandler(gridGroupingControl1_CurrentRecordContextChange);

            // Assign data source
            this.gridGroupingControl1.DataMember = null;
            this.gridGroupingControl1.DataSource = this.dataSet11.Order_Details;

            quantityFieldDescriptor = this.gridGroupingControl1.TableDescriptor.Fields["Quantity"];

            // Add a filter so that we can check out difference between VisibleCustomCount (only records that meet criteria are counted)
            // and CustomCount (all records are counted)
            this.gridGroupingControl1.TableDescriptor.RecordFilters.Add("[UnitPrice] > 20");

            this.gridGroupingControl1.FilterRuntimeProperties = true;

            this.gridGroupingControl1.TableControlCellClick += new GridTableControlCellClickEventHandler(gridGroupingControl1_TableControlCellClick);
            this.gridGroupingControl1.TableDescriptor.Columns["QuantityCount"].AllowGroupByColumn  = false;
            this.gridGroupingControl1.TableDescriptor.Columns["QuantityCount2"].AllowGroupByColumn = false;

            //Hook-up the QueryColWidth event to set the Column width.
            this.gridGroupingControl1.TableModel.QueryColWidth += new GridRowColSizeEventHandler(TableModel_QueryColWidth);
        }
示例#15
0
        private void testgrid2_Load(object sender, EventArgs e)
        {
            gc1.ShowGroupDropArea = true;
            // gc1.DataSource = ds_activejobs;
            activeJobsTableAdapter.Fill(this.ds_activejobs.ActiveJobs);

            gc1.TableModel.ReadOnly = true;

            zoom = new ZoomGroupingGrid(gc1);

            // gc1.DataMember = ds_activejobs.ActiveJobs;

            Syncfusion.Grouping.SortColumnDescriptor cd = new Syncfusion.Grouping.SortColumnDescriptor("ShipDate");

            cd.Categorizer = new CustomCategorizer();
            this.gc1.TableDescriptor.GroupedColumns.Add(cd);
            //   this.gc1.QueryCellText += gc1_QueryCellText;

            //Summary Columns

            TestEntities db       = new TestEntities();
            DateTime     maxbatch = db.Batches.Max(p => p.BatchTime);


            lblTimeStamp.Text = "Data Accurate as of: " + maxbatch.ToString();

            #region summary columns

            gc1.TableDescriptor.VisibleColumns.Remove("ShipMonth");
            gc1.TableDescriptor.VisibleColumns.Remove("Batch");
            gc1.TableDescriptor.Columns["ShipDate"].Appearance.AnyRecordFieldCell.Format = "MM/dd/yyyy";

            gc1.TableDescriptor.Appearance.AnyRecordFieldCell.WrapText = true;

            gc1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table());

            GridSummaryColumnDescriptor sc1 = new GridSummaryColumnDescriptor();
            sc1.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc1.DataMember  = "RemainingRev";
            sc1.Format      = "{Sum}";
            sc1.Name        = "Remaining Revenue";
            sc1.SummaryType = SummaryType.Int32Aggregate;



            GridSummaryColumnDescriptor sc2 = new GridSummaryColumnDescriptor();
            sc2.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc2.DataMember  = "POValue";
            sc2.Format      = "{Sum}";
            sc2.Name        = "Purchase Order Value";
            sc2.SummaryType = SummaryType.Int32Aggregate;


            //   sc2.TableDescriptor.Columns[0].Appearance.AnyRecordFieldCell.Format = "C";


            GridSummaryColumnDescriptor sc3 = new GridSummaryColumnDescriptor();
            sc3.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc3.DataMember  = "Actual";
            sc3.Format      = "{Sum}";
            sc3.Name        = "Actual";
            sc3.SummaryType = SummaryType.Int32Aggregate;

            sc1.Appearance.AnySummaryCell.Format = "c";
            sc2.Appearance.AnySummaryCell.Format = "c";
            sc3.Appearance.AnySummaryCell.Format = "c";

            GridSummaryColumnDescriptor sc4 = new GridSummaryColumnDescriptor();
            sc4.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc4.DataMember  = "Weld";
            sc4.Format      = "{Sum}";
            sc4.Name        = "Weld Hours Remaining";
            sc4.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc5 = new GridSummaryColumnDescriptor();
            sc5.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc5.DataMember  = "Machine";
            sc5.Format      = "{Sum}";
            sc5.Name        = "Machine Hours Remaining";
            sc5.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc6 = new GridSummaryColumnDescriptor();
            sc6.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc6.DataMember  = "Design";
            sc6.Format      = "{Sum}";
            sc6.Name        = "Design Hours Remaining";
            sc6.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc7 = new GridSummaryColumnDescriptor();
            sc7.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc7.DataMember  = "Tracker";
            sc7.Format      = "{Sum}";
            sc7.Name        = "Tracker Hours Remaining";
            sc7.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc8 = new GridSummaryColumnDescriptor();
            sc8.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc8.DataMember  = "Build";
            sc8.Format      = "{Sum}";
            sc8.Name        = "Build Hours Remaining";
            sc8.SummaryType = SummaryType.Int32Aggregate;


            GridSummaryRowDescriptor sr1 = new GridSummaryRowDescriptor();
            sr1.SummaryColumns.Add(sc1);
            sr1.SummaryColumns.Add(sc2);
            sr1.SummaryColumns.Add(sc3);
            sr1.SummaryColumns.Add(sc4);
            sr1.SummaryColumns.Add(sc5);
            sr1.SummaryColumns.Add(sc6);
            sr1.SummaryColumns.Add(sc7);
            sr1.SummaryColumns.Add(sc8);

            gc1.Appearance.AnySummaryCell.HorizontalAlignment = GridHorizontalAlignment.Right;

            sr1.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(255, 231, 162));

            gc1.TableDescriptor.SummaryRows.Add(sr1);

            #endregion


            //   gc1.TableControl.PrepareViewStyleInfo += new;

            gc1.TableControl.CommentTipShowing += new CommentTipShowingEventHandler(TableControl_CommentTipShowing);



            //GridConditionalFormatDescriptor f1 = new GridConditionalFormatDescriptor();
            f1.Appearance.AnyRecordFieldCell.Interior  = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(220, 20, 60));
            f1.Appearance.AnyRecordFieldCell.TextColor = Color.White;
            f1.Expression = "[age1] > 10 and [Comp] < 20";
            f1.Name       = "Format1";

            //GridConditionalFormatDescriptor f2 = new GridConditionalFormatDescriptor();
            f2.Appearance.AnyRecordFieldCell.Interior  = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(30, 144, 255));
            f2.Appearance.AnyRecordFieldCell.TextColor = Color.White;
            f2.Expression = "[age1] < 10";
            f2.Name       = "Format2";

            gc1.TableDescriptor.ConditionalFormats.Add(f1);
            gc1.TableDescriptor.ConditionalFormats.Add(f2);

            gc1.QueryCellStyleInfo             += new GridTableCellStyleInfoEventHandler(gc1_QueryCellStyleInfo);
            gc1.SourceListListChangedCompleted += Gc1_SourceListListChangedCompleted;

            GridColumnDescriptor desc1 = new GridColumnDescriptor();

            desc1.MappingName = "BaseID";
            desc1.Appearance.AnyRecordFieldCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(237, 240, 246));

            gc1.TableControl.HScroll = true;
            gc1.TableControl.VScroll = true;

            if (gc1.TableControl.HScrollBar.InnerScrollBar != null && gc1.TableControl.VScrollBar != null)
            {
                gc1.TableControl.HScrollBar.InnerScrollBar.Height = 50;
                gc1.TableControl.VScrollBar.InnerScrollBar.Height = 50;
            }


            gc1.TableControl.ControlAdded += TableControl_ControlAdded;
        }