void generator_CustomizeColumn(object source, ControlCustomizationEventArgs e)
 {
     if (e.FieldName == "Discontinued")
     {
         XRShape control = new XRShape();
         control.SizeF     = e.Owner.SizeF;
         control.LocationF = new System.Drawing.PointF(0, 0);
         e.Owner.Controls.Add(control);
         control.Shape = new ShapeStar()
         {
             StarPointCount = 5, Concavity = 30
         };
         control.BeforePrint += new System.Drawing.Printing.PrintEventHandler(control_BeforePrint);
         e.IsModified         = true;
     }
 }
Ejemplo n.º 2
0
        void InitDetailsAndPageHeader(ASPxGridView aspxGridView1)
        {
            ReadOnlyCollection <GridViewDataColumn> groupedColumns = aspxGridView1.GetGroupedColumns();

            int pagewidth             = (report.PageWidth - (report.Margins.Left + report.Margins.Right)) - groupedColumns.Count * subGroupOffset;
            List <ColumnInfo> columns = GetColumnsInfo(aspxGridView1, pagewidth);

            if (CustomizeColumnsCollection != null)
            {
                CustomizeColumnsCollection(report, new ColumnsCreationEventArgs(pagewidth)
                {
                    ColumnsInfo = columns
                });
            }

            report.Bands.Add(new DetailBand()
            {
                HeightF = bandHeight
            });
            report.Bands.Add(new PageHeaderBand()
            {
                HeightF = bandHeight
            });

            XRTable    headerTable = new XRTable();
            XRTableRow row         = new XRTableRow();
            XRTable    detailTable = new XRTable();
            XRTableRow row2        = new XRTableRow();

            for (int i = 0; i < columns.Count; i++)
            {
                if (columns[i].IsVisible)
                {
                    XRTableCell cell = new XRTableCell();
                    cell.Width = columns[i].ColumnWidth;
                    cell.Text  = columns[i].FieldName;
                    row.Cells.Add(cell);

                    XRTableCell cell2 = new XRTableCell();
                    cell2.Width = columns[i].ColumnWidth;
                    ControlCustomizationEventArgs cc = new ControlCustomizationEventArgs()
                    {
                        FieldName = columns[i].FieldName, IsModified = false, Owner = cell2
                    };
                    if (CustomizeColumn != null)
                    {
                        CustomizeColumn(report, cc);
                    }
                    if (cc.IsModified == false)
                    {
                        cell2.DataBindings.Add("Text", null, columns[i].FieldName);
                    }
                    detailsInfo.Add(columns[i].GridViewColumn, cell2);
                    row2.Cells.Add(cell2);
                }
            }
            headerTable.Rows.Add(row);
            headerTable.Width     = pagewidth;
            headerTable.LocationF = new PointF(groupedColumns.Count * subGroupOffset, 0);
            headerTable.Borders   = BorderSide.Bottom;

            detailTable.Rows.Add(row2);
            detailTable.LocationF = new PointF(groupedColumns.Count * subGroupOffset, 0);
            detailTable.Width     = pagewidth;

            report.Bands[BandKind.PageHeader].Controls.Add(headerTable);
            report.Bands[BandKind.Detail].Controls.Add(detailTable);
        }