protected override void UpdateInfoCore() { this.UpdateFormattingObject(); this.UpdateParentFormattingObject(); this.SetTextAlignment(); this.IsFirstDataCell = this.ColumnInfo == this.TableElement.ViewElement.RowLayout.FirstDataColumn; this.IsLastDataCell = this.ColumnInfo == this.TableElement.ViewElement.RowLayout.LastDataColumn; GridViewCellInfo cell = this.RowInfo.Cells[this.ColumnInfo.Name]; if (cell != null) { this.UpdateErrorInfo(cell); this.UpdateStyle(cell); } if (this.MasterTemplate.SelectionMode == GridViewSelectionMode.CellSelect) { this.IsSelected = this.MasterTemplate.SelectedCells.IsSelected(this.RowInfo, this.ColumnInfo); this.RowElement.UpdateContainsCellsState(); } else { this.IsSelected = false; this.RowElement.UpdateContainsCellsState(); } this.UpdateSelfReferenceLayout(); base.UpdateInfoCore(); this.IsPinned = this.ColumnInfo.PinPosition != PinnedColumnPosition.None || this.RowInfo.PinPosition != PinnedRowPosition.None; }
protected virtual CellPrintElement CreateImageCellPrintElement( GridViewCellInfo cellInfo) { CellPrintElement cellPrintElement = new CellPrintElement(); object obj = cellInfo.Value; if (obj == null || obj == DBNull.Value) { cellPrintElement.Image = (Image)null; return(cellPrintElement); } if (obj is byte[]) { cellPrintElement.Image = ImageHelper.GetImageFromBytes((byte[])obj); } else if (obj is Image) { cellPrintElement.Image = obj as Image; } if (cellPrintElement.Image != null) { GridViewImageColumn columnInfo = cellInfo.ColumnInfo as GridViewImageColumn; cellPrintElement.ImageLayout = columnInfo != null ? columnInfo.ImageLayout : ImageLayout.Stretch; cellPrintElement.ImageAlignment = columnInfo != null ? columnInfo.ImageAlignment : ContentAlignment.MiddleCenter; } return(cellPrintElement); }
public AccessibleObject GetCellAccessibleObject( GridViewCellInfo cellInfo, RowAccessibleObject parent) { lock (RadGridViewAccessibleObject.syncObj) { if (!this.cellCache.ContainsKey(cellInfo)) { this.cellCache.Add(cellInfo, new CellAccessibleObject(this.owner, cellInfo, parent)); } } return((AccessibleObject)this.cellCache[cellInfo]); }
public CellAccessibleObject( RadGridView owner, GridViewCellInfo cell, RowAccessibleObject parent) { this.owner = owner; this.parent = parent; this.cell = cell; this.column = cell.ColumnInfo; this.row = cell.RowInfo; this.isXP = Environment.OSVersion.Version.Major <= 5; this.owner.CellBeginEdit += new GridViewCellCancelEventHandler(this.owner_CellBeginEdit); this.owner.CellEndEdit += new GridViewCellEventHandler(this.owner_CellEndEdit); }
protected virtual void UpdateErrorInfo(GridViewCellInfo cellInfo) { if (this.GridViewElement.ShowCellErrors) { string errorText = cellInfo.ErrorText; if (!string.IsNullOrEmpty(errorText)) { this.ToolTipText = errorText; int num = (int)this.SetValue(GridDataCellElement.ContainsErrorsProperty, (object)true); return; } } if (!this.ContainsErrors) { return; } this.ToolTipText = string.Empty; int num1 = (int)this.SetValue(GridDataCellElement.ContainsErrorsProperty, (object)false); }
protected virtual CellPrintElement CreateSummaryCellPrintElement( GridViewCellInfo cellInfo) { CellPrintElement cellPrintElement = new CellPrintElement(); cellPrintElement.BackColor = this.GridView.PrintStyle.SummaryCellBackColor; cellPrintElement.BorderColor = this.GridView.PrintStyle.BorderColor; Color backColor = cellPrintElement.BackColor; if (cellPrintElement.BackColor != Color.Transparent && cellPrintElement.BackColor != Color.Empty) { cellPrintElement.DrawFill = true; } cellPrintElement.Text = cellInfo.Value != null?cellInfo.Value.ToString() : string.Empty; if (this.GridView.RightToLeft == RightToLeft.Yes) { cellPrintElement.StringFormatFlags |= StringFormatFlags.DirectionRightToLeft; } return(cellPrintElement); }
public GridViewCellStyle(GridViewCellInfo ownerCell) { this.ownerCell = ownerCell; }
protected virtual void PrintRow( GridViewRowInfo row, TableViewRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics, Rectangle drawArea) { List <GridViewColumn> gridViewColumnList = new List <GridViewColumn>(); float num1 = 1f; if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { float num2 = 0.0f; foreach (GridViewColumn column in (List <GridViewColumn>) this.PrintPages[this.CurrentPrintPage]) { if (!column.IsGrouped) { num2 += (float)rowLayout.GetColumnWidth(column); gridViewColumnList.Add(column); } } num1 = (float)drawArea.Width / num2; } else { foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { gridViewColumnList.Add(renderColumn); } } int num3 = row.Group != null ? row.Group.Level + 1 : 0; if (this.GridView.RightToLeft != RightToLeft.Yes) { currentX += (row.HierarchyLevel - num3) * settings.HierarchyIndent; } else { currentX -= (row.HierarchyLevel - num3) * settings.HierarchyIndent; } float num4 = 0.0f; float num5 = 0.0f; float num6 = 0.0f; bool flag = true; foreach (GridViewColumn gridViewColumn in gridViewColumnList) { if (!(gridViewColumn is GridViewRowHeaderColumn) && !(gridViewColumn is GridViewIndentColumn) && gridViewColumn.PinPosition == PinnedColumnPosition.Left) { num5 = (float)rowLayout.Owner.CellSpacing; num6 = (float)rowLayout.Owner.CellSpacing; break; } } foreach (GridViewColumn column in gridViewColumnList) { if (!(column is GridViewRowHeaderColumn) && !(column is GridViewIndentColumn)) { TableViewCellArrangeInfo arrangeInfo = rowLayout.LayoutImpl.GetArrangeInfo(column); if (arrangeInfo != null) { float x = arrangeInfo.OffsetX < 0 ? 0.0f : (float)arrangeInfo.OffsetX; float y = (float)(int)arrangeInfo.Bounds.Y; float width = (float)arrangeInfo.CachedWidth; float height = (float)(this.GetDataRowHeight(row, (TableViewRowLayoutBase)rowLayout) + this.GridView.TableElement.RowSpacing); int num2 = flag ? 0 : rowLayout.Owner.CellSpacing; flag = false; if ((double)y + (double)height > (double)drawArea.Bottom) { height = (float)drawArea.Height - y; } if (column.PinPosition == PinnedColumnPosition.Left) { num5 += width + (float)num2; num6 += width + (float)num2; } else if (column.PinPosition == PinnedColumnPosition.None) { num6 += width + (float)num2; x += num5; } else { x += num6; } if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { x = num4; width = (float)Math.Ceiling((double)(width * num1)); } if (this.GridView.RightToLeft == RightToLeft.Yes) { x = (float)drawArea.Width - width - x; } RectangleF rectangleF = new RectangleF(x, y, width, height); rectangleF.Offset((float)currentX, (float)currentY); CellPrintElement cellPrintElement; if (row is GridViewTableHeaderRowInfo) { GridViewCellInfo cell = this.GridView.MasterView.TableHeaderRow.Cells[column.Name]; cellPrintElement = this.CreateHeaderCellPrintElement(column); if (cellPrintElement.Font != settings.HeaderCellFont) { if (settings.HeaderCellFont != null) { cellPrintElement.Font = settings.HeaderCellFont; } else { settings.HeaderCellFont = cellPrintElement.Font; } } } else if (row is GridViewSummaryRowInfo) { cellPrintElement = this.CreateSummaryCellPrintElement((row as GridViewSummaryRowInfo).Cells[column.Name]); if (cellPrintElement.Font != settings.SummaryCellFont) { if (settings.SummaryCellFont != null) { cellPrintElement.Font = settings.SummaryCellFont; } else { settings.SummaryCellFont = cellPrintElement.Font; } } } else { cellPrintElement = this.CreateDataCellPrintElement(row.Cells[column.Name]); if (cellPrintElement.Font != settings.CellFont) { if (settings.CellFont != null) { cellPrintElement.Font = settings.CellFont; } else { settings.CellFont = cellPrintElement.Font; } } } if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { num4 += width; } cellPrintElement.TextPadding = this.GridView.PrintStyle.CellPadding; cellPrintElement.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; Rectangle rectangle = new Rectangle((int)rectangleF.X, (int)rectangleF.Y, (int)rectangleF.Width, (int)rectangleF.Height); PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, column, cellPrintElement); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, column, rectangle)); } } } }
protected virtual void PrintRow( GridViewRowInfo row, ColumnGroupRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { float num1 = 0.0f; float num2 = 0.0f; foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { if (!(renderColumn is GridViewRowHeaderColumn) && !(renderColumn is GridViewIndentColumn)) { float rowHeight = (float)rowLayout.GetRowHeight(row); RectangleF correctedColumnBounds = rowLayout.GetCorrectedColumnBounds(row, renderColumn, this.GridView.RightToLeft == RightToLeft.Yes, new RectangleF(0.0f, 0.0f, rowLayout.DesiredSize.Width, rowHeight)); if (!(correctedColumnBounds == RectangleF.Empty)) { if (renderColumn.PinPosition == PinnedColumnPosition.Left) { if ((double)num1 < (double)correctedColumnBounds.Right + (double)rowLayout.Owner.CellSpacing) { num1 = correctedColumnBounds.Right + (float)rowLayout.Owner.CellSpacing; num2 = num1; } } else if (renderColumn.PinPosition == PinnedColumnPosition.None) { if ((double)num2 < (double)num1 + (double)correctedColumnBounds.Right + (double)rowLayout.Owner.CellSpacing) { num2 = num1 + correctedColumnBounds.Right + (float)rowLayout.Owner.CellSpacing; } correctedColumnBounds.X += num1; } else { correctedColumnBounds.X += num2; } correctedColumnBounds.Offset((float)currentX, (float)currentY); CellPrintElement cellPrintElement; if (row is GridViewTableHeaderRowInfo) { GridViewCellInfo cell = this.GridView.MasterView.TableHeaderRow.Cells[renderColumn.Name]; cellPrintElement = this.CreateHeaderCellPrintElement(renderColumn); if (cellPrintElement.Font != settings.HeaderCellFont) { if (settings.HeaderCellFont != null) { cellPrintElement.Font = settings.HeaderCellFont; } else { settings.HeaderCellFont = cellPrintElement.Font; } } } else if (row is GridViewSummaryRowInfo) { GridViewCellInfo cell = (row as GridViewSummaryRowInfo).Cells[renderColumn.Name]; if (cell != null) { cellPrintElement = this.CreateSummaryCellPrintElement(cell); if (cellPrintElement.Font != settings.SummaryCellFont) { if (settings.SummaryCellFont != null) { cellPrintElement.Font = settings.SummaryCellFont; } else { settings.SummaryCellFont = cellPrintElement.Font; } } } else { continue; } } else { GridViewCellInfo cell = row.Cells[renderColumn.Name]; if (cell != null) { if (renderColumn is GridViewImageColumn) { cellPrintElement = this.CreateImageCellPrintElement(cell); } else { cellPrintElement = this.CreateDataCellPrintElement(cell); if (cellPrintElement.Font != settings.CellFont) { if (settings.CellFont != null) { cellPrintElement.Font = settings.CellFont; } else { settings.CellFont = cellPrintElement.Font; } } } } else { continue; } } cellPrintElement.TextPadding = this.GridView.PrintStyle.CellPadding; cellPrintElement.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; Rectangle rectangle = new Rectangle((int)correctedColumnBounds.X, (int)correctedColumnBounds.Y, (int)correctedColumnBounds.Width, (int)correctedColumnBounds.Height); PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, renderColumn, cellPrintElement); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, renderColumn, rectangle)); } } } }
protected virtual CellPrintElement CreateDataCellPrintElement( GridViewCellInfo cellInfo) { CellPrintElement cellPrintElement; if (cellInfo.ColumnInfo is GridViewImageColumn) { cellPrintElement = this.CreateImageCellPrintElement(cellInfo); cellPrintElement.DrawText = false; } else { cellPrintElement = new CellPrintElement(); } if (this.GridView.PrintStyle.PrintAlternatingRowColor && this.GridView.PrintStyle.PrintTraverser.Current.Index % 2 == 1) { cellPrintElement.BackColor = this.GridView.PrintStyle.AlternatingRowColor; } else { cellPrintElement.BackColor = this.GridView.PrintStyle.CellBackColor; } cellPrintElement.BorderColor = this.GridView.PrintStyle.BorderColor; Color backColor = cellPrintElement.BackColor; if (cellPrintElement.BackColor != Color.Transparent && cellPrintElement.BackColor != Color.Empty) { cellPrintElement.DrawFill = true; } GridViewDataColumn columnInfo1 = cellInfo.ColumnInfo as GridViewDataColumn; object lookupValue = cellInfo.Value; GridViewComboBoxColumn columnInfo2 = cellInfo.ColumnInfo as GridViewComboBoxColumn; if (columnInfo2 != null && columnInfo2.HasLookupValue) { lookupValue = columnInfo2.GetLookupValue(lookupValue); } if (columnInfo1 != null && !string.IsNullOrEmpty(columnInfo1.FormatString)) { if (cellInfo.ColumnInfo is GridViewComboBoxColumn) { GridViewComboBoxColumn columnInfo3 = (GridViewComboBoxColumn)cellInfo.ColumnInfo; columnInfo1.DataType = columnInfo3.DisplayMemberDataType; columnInfo1.DataTypeConverter = TypeDescriptor.GetConverter(columnInfo3.DisplayMemberDataType); cellPrintElement.Text = RadDataConverter.Instance.Format(lookupValue, typeof(string), (IDataConversionInfoProvider)columnInfo1) as string; } else { cellPrintElement.Text = RadDataConverter.Instance.Format(lookupValue, typeof(string), (IDataConversionInfoProvider)columnInfo1) as string; } } else { cellPrintElement.Text = lookupValue != null?lookupValue.ToString() : string.Empty; } cellPrintElement.TextAlignment = cellInfo.ColumnInfo.TextAlignment; cellPrintElement.StringTrimming = StringTrimming.EllipsisCharacter; if (this.GridView.RightToLeft == RightToLeft.Yes) { cellPrintElement.StringFormatFlags |= StringFormatFlags.DirectionRightToLeft; } if (!cellInfo.ColumnInfo.WrapText) { cellPrintElement.StringFormatFlags |= StringFormatFlags.NoWrap; } return(cellPrintElement); }
protected virtual void PrintRow( GridViewRowInfo row, HtmlViewRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { if (!(renderColumn is GridViewRowHeaderColumn) && !(renderColumn is GridViewIndentColumn)) { HtmlViewCellArrangeInfo arrangeInfo = rowLayout.GetArrangeInfo(renderColumn); if (arrangeInfo != null) { RectangleF bounds = arrangeInfo.Bounds; bounds.Offset((float)currentX, (float)currentY); CellPrintElement cellPrintElement; if (row is GridViewTableHeaderRowInfo) { GridViewCellInfo cell = this.GridView.MasterView.TableHeaderRow.Cells[renderColumn.Name]; cellPrintElement = this.CreateHeaderCellPrintElement(renderColumn); if (cellPrintElement.Font != settings.HeaderCellFont) { if (settings.HeaderCellFont != null) { cellPrintElement.Font = settings.HeaderCellFont; } else { settings.HeaderCellFont = cellPrintElement.Font; } } } else if (row is GridViewSummaryRowInfo) { cellPrintElement = this.CreateSummaryCellPrintElement((row as GridViewSummaryRowInfo).Cells[renderColumn.Name]); if (cellPrintElement.Font != settings.SummaryCellFont) { if (settings.SummaryCellFont != null) { cellPrintElement.Font = settings.SummaryCellFont; } else { settings.SummaryCellFont = cellPrintElement.Font; } } } else { GridViewCellInfo cell = row.Cells[renderColumn.Name]; if (renderColumn is GridViewImageColumn) { cellPrintElement = this.CreateImageCellPrintElement(cell); } else { cellPrintElement = this.CreateDataCellPrintElement(cell); if (cellPrintElement.Font != settings.CellFont) { if (settings.CellFont != null) { cellPrintElement.Font = settings.CellFont; } else { settings.CellFont = cellPrintElement.Font; } } } } cellPrintElement.TextPadding = this.GridView.PrintStyle.CellPadding; cellPrintElement.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; Rectangle rectangle = new Rectangle((int)bounds.X, (int)bounds.Y, (int)bounds.Width, (int)bounds.Height); PrintCellFormattingEventArgs e = new PrintCellFormattingEventArgs(row, renderColumn, cellPrintElement); this.OnPrintCellFormatting(e); e.PrintCell.Paint(graphics, rectangle); this.OnPrintCellPaint(new PrintCellPaintEventArgs(graphics, row, renderColumn, rectangle)); } } } }
protected virtual void UpdateStyle(GridViewCellInfo cellInfo) { if (cellInfo.HasStyle) { this.ForeColor = cellInfo.Style.ForeColor; if (cellInfo.Style.GetValueSource(GridViewCellStyle.FontProperty) == ValueSource.Local) { this.Font = cellInfo.Style.Font; } else { int num = (int)this.ResetValue(VisualElement.FontProperty, ValueResetFlags.Local); } if (cellInfo.Style.CustomizeFill) { this.DrawFill = cellInfo.Style.DrawFill; this.BackColor = cellInfo.Style.BackColor; this.BackColor2 = cellInfo.Style.BackColor2; this.BackColor3 = cellInfo.Style.BackColor3; this.BackColor4 = cellInfo.Style.BackColor4; this.GradientStyle = cellInfo.Style.GradientStyle; this.GradientAngle = cellInfo.Style.GradientAngle; this.GradientPercentage = cellInfo.Style.GradientPercentage; this.GradientPercentage2 = cellInfo.Style.GradientPercentage2; this.NumberOfColors = cellInfo.Style.NumberOfColors; } else { this.ResetFillProperties(); } if (cellInfo.Style.CustomizeBorder) { this.DrawBorder = cellInfo.Style.DrawBorder; this.BorderBoxStyle = cellInfo.Style.BorderBoxStyle; this.BorderWidth = cellInfo.Style.BorderWidth; this.BorderLeftWidth = cellInfo.Style.BorderLeftWidth; this.BorderRightWidth = cellInfo.Style.BorderRightWidth; this.BorderTopWidth = cellInfo.Style.BorderTopWidth; this.BorderBottomWidth = cellInfo.Style.BorderBottomWidth; this.BorderGradientAngle = cellInfo.Style.BorderGradientAngle; this.BorderGradientStyle = cellInfo.Style.BorderGradientStyle; this.BorderColor = cellInfo.Style.BorderColor; this.BorderColor2 = cellInfo.Style.BorderColor2; this.BorderColor3 = cellInfo.Style.BorderColor3; this.BorderColor4 = cellInfo.Style.BorderColor4; this.BorderInnerColor = cellInfo.Style.BorderInnerColor; this.BorderInnerColor2 = cellInfo.Style.BorderInnerColor2; this.BorderInnerColor3 = cellInfo.Style.BorderInnerColor3; this.BorderInnerColor4 = cellInfo.Style.BorderInnerColor4; this.BorderTopColor = cellInfo.Style.BorderTopColor; this.BorderBottomColor = cellInfo.Style.BorderBottomColor; this.BorderLeftColor = cellInfo.Style.BorderLeftColor; this.BorderRightColor = cellInfo.Style.BorderRightColor; } else { this.ResetBorderProperties(); } this.cellStyleApplied = true; } else { if (!this.cellStyleApplied) { return; } int num1 = (int)this.ResetValue(VisualElement.ForeColorProperty, ValueResetFlags.Local); int num2 = (int)this.ResetValue(VisualElement.FontProperty, ValueResetFlags.Local); this.ResetFillProperties(); this.ResetBorderProperties(); } }