static void DrawCell(PopupFormGraphicsInfoArgs args, int rowIndex, ResultColumn column, int x) { var info = (ItemSelectorPopupFormViewInfo)args.ViewInfo; //Subtract the padding from the left edge and the width. (To preserve the right edge) x += info.CellPaddingLeft; var location = new Point(x, info.GetRowCoordinate(rowIndex)); var cellWidth = Math.Min(column.Width - info.CellPaddingLeft, info.RowsArea.Right - info.HoverElement.ContentMargins.Right - x); var cellBounds = new Rectangle(location, new Size(cellWidth, info.RowHeight)); var text = column.GetValue(info.Rows[rowIndex]); //If this cell matched the filter, find the matching prefix. //I take the prefix from the cell value instead of the actual //word to allow for variations in case and hyphens. string matchedPart = null; if (column.ShouldFilter && info.FilterWords.Any()) { var match = info.FilterWords.FirstOrDefault(fw => ItemSelector.ValueMatches(filterWord: fw, columnValue: text)); if (match != null) { matchedPart = text.Substring(0, match.Length); //The match might be the entire value } } Brush colorOverride = null; if (rowIndex == info.HoveredIndex && info.HoverElement.Color.ForeColor != info.AppearanceResults.GetForeColor()) { colorOverride = args.Cache.GetSolidBrush(info.HoverElement.Color.ForeColor); } if (String.IsNullOrEmpty(matchedPart)) { info.AppearanceResults.DrawStringDefaultColor(args.Cache, text, cellBounds, colorOverride); } else { info.AppearanceMatch.DrawStringDefaultColor(args.Cache, matchedPart, cellBounds, colorOverride); var matchSize = Size.Ceiling(info.AppearanceMatch.CalcTextSize(args.Cache, matchedPart, cellWidth)); matchSize.Width++; //DevExpress measures very aggressively cellBounds.X += matchSize.Width; cellBounds.Width -= matchSize.Width; info.AppearanceResults.DrawStringDefaultColor(args.Cache, text.Substring(matchedPart.Length), cellBounds, colorOverride); } }
static void DrawCell(PopupFormGraphicsInfoArgs args, int rowIndex, ResultColumn column, int x) { var info = (ItemSelectorPopupFormViewInfo)args.ViewInfo; //Subtract the padding from the left edge and the width. (To preserve the right edge) x += info.CellPaddingLeft; var location = new Point(x, info.GetRowCoordinate(rowIndex)); var cellWidth = Math.Min(column.Width - info.CellPaddingLeft, info.RowsArea.Right - info.HoverElement.ContentMargins.Right - x); var cellBounds = new Rectangle(location, new Size(cellWidth, info.RowHeight)); var text = column.GetValue(info.Rows[rowIndex]); //If this cell matched the filter, find the matching prefix. //I take the prefix from the cell value instead of the actual //word to allow for variations in case and hyphens. string matchedPart = null; if (column.ShouldFilter && info.FilterWords.Any()) { var match = info.FilterWords.FirstOrDefault(fw => ItemSelector.ValueMatches(filterWord: fw, columnValue: text)); if (match != null) matchedPart = text.Substring(0, match.Length); //The match might be the entire value } Brush colorOverride = null; if (rowIndex == info.HoveredIndex && info.HoverElement.Color.ForeColor != info.AppearanceResults.GetForeColor()) colorOverride = args.Cache.GetSolidBrush(info.HoverElement.Color.ForeColor); if (String.IsNullOrEmpty(matchedPart)) info.AppearanceResults.DrawStringDefaultColor(args.Cache, text, cellBounds, colorOverride); else { info.AppearanceMatch.DrawStringDefaultColor(args.Cache, matchedPart, cellBounds, colorOverride); var matchSize = Size.Ceiling(info.AppearanceMatch.CalcTextSize(args.Cache, matchedPart, cellWidth)); matchSize.Width++; //DevExpress measures very aggressively cellBounds.X += matchSize.Width; cellBounds.Width -= matchSize.Width; info.AppearanceResults.DrawStringDefaultColor(args.Cache, text.Substring(matchedPart.Length), cellBounds, colorOverride); } }
public ColumnComparer(ResultColumn column) { this.column = column; }
protected override void SetItem(int index, ResultColumn item) { base.SetItem(index, item); Invalidate(); }