i've set the following property on my grid:
now say i put the following value into it:
case (1) - if the cell is really small, it does the following (which i like):
case (2) - if the cell is a little bigger, it does the following (i don't like this):
if it's big enough to display that elipsis, i'd rather it display another digit of precision after the decimal place. with case (1) i'm ok sacrificing precision to get the ellipsis because otherwise the user has no means of knowing whether that says 872 or 87234591.
but with case (2), the user can see the decimal point so s/he knows the absolute size of the number in there (can't confuse 872 with 8725897)
case (3) - sometimes i get this:
in this case (3) there are four periods because the decimal place is right next to the ellipsis. this is confusing.
what i'd like is these cases to show:
any advice?
YES!
RectInsideBorders was the magic infragistics property I was looking for.
Fanx.
mildavi said:why does the last cell in the row require a larger triangle
You are probably right, it probably has to do with the borders. A cell does not draw all four of it's own borders. It only draws one or two sides and relies on the adjacent cells to draw the others. So the last cell in the row probably has to draw the right border where the other cells to do. You should probably use the element.RectInsideBorders (as opposed to Rect), if you are not already doing so.
mildavi said:is there a better way to detect this than what i'm currently doing
I didn't look at the code that closely, but if it's working, I say go with it. :)
yea, it works fine. i'm just curious why i have to muck around with that triangleSize bit.
Your sample attached here seems to work okay. Are you still having a problem with this?Or did yuo just post this for others to use? :)
using System.Drawing;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
namespace Infragistics.Test
{
class OverflowIndicatorFilter : IUIElementDrawFilter
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams)
if (drawParams.Element is CellUIElement)
return DrawPhase.BeforeDrawImage;
}
return DrawPhase.None;
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
switch(drawPhase)
case DrawPhase.BeforeDrawImage:
var cell = drawParams.Element.SelectableItem as UltraGridCell;
if (cell == null) return true;
if (!ShouldDraw(cell, drawParams.Graphics, drawParams.Font)) return true;
DrawTriangle(drawParams.Graphics, drawParams.Element.Rect, IsLastCell(cell));
return true;
default:
return false;
/// <summary>
/// Measure the contents of the cell. If the text is bigger than the cell width, draw the triangle.
/// </summary>
private static bool ShouldDraw (UltraGridCell cell_, Graphics graphics_, Font font_)
var size = graphics_.MeasureString(cell_.Text, font_);
return (size.Width > cell_.Width);
/// Need to check if it's the last cell in the row because it needs one less
/// pixel of triangle. No cell border, just row border?
private static bool IsLastCell (UltraGridCell cell_)
int n = cell_.Row.Cells.Count;
int i = cell_.Row.Cells.IndexOf(cell_);
return n == i + 1;
private static void DrawTriangle (Graphics g_, Rectangle rect_, bool last_)
int triangleSize = last_ ? 7 : 8; // if it's in the last row, need a smaller triangle
var corner = new Point(rect_.Location.X + rect_.Width, rect_.Location.Y + rect_.Height);
var vertical = new Point(corner.X, corner.Y - triangleSize);
var horiz = new Point(corner.X - triangleSize, corner.Y);
g_.FillPolygon(Brushes.Black, new[ { corner, vertical, horiz });