Hi,
I am using win UltraGrid to display in a table format. I want set border top, right, left as null and only bottom border should be visible in row.
Does it possible in Infragistic Grid? Please help me ASAP
Thanks in Advance
Hi Hiren,
I'm not sure why this is not working, I would have to run it so debug it. But you probably don't need to call DrawBorders, anyway - there is an easier way. If you leave BorderStyleCell and BorderStyleRow to true, the cells and rows will draw their own borders. If you want to control which sides they draw, you can simply change the drawParams.BorderSides property. So you could examine this property to see which sides the cell or row is going to draw and then add or remove sides from this flagged enum to alter which sides are actually drawn. Seems to me like a simpler way to acheive what you want.
If I had to guess, I'd say that the cell below the one you are drawing on is overlapping the bottom of the cell. The cells have to overlap sometimes so as not to draw double-thick borders. To test this, try setting grid.DisplayLayout.Override.CellPadding to something like 5. This will place padding between every cell and prevent cells from overlapping. You probably don't want your grid to look like that, but at least it will give you a way to see if your code is working and if overlapping is, in fact, the problem.
Hi Mike,
I am very much thankful to you. because i completed my task in time.
now i have very small problem i am not able to draw line on perticular one cell. following code i have wriiten.
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // (i.e. the focus rect should NOT be drawn). bool bReturnvalue = false; if (drawParams.Element.GetType().Equals(typeof(RowUIElement))) { RowUIElement uieRow = (RowUIElement)drawParams.Element; //drawParams.DrawFocusRectangle(uieRow.Rect, Color.White, Color.White); if (uieRow.Row.Cells["Date_Time"].Text != string.Empty && uieRow.Row.Cells["Job"].Text == string.Empty) { drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Bottom); } } else if (drawParams.Element.GetType().Equals(typeof(CellUIElement))) { CellUIElement uieCell = (CellUIElement)drawParams.Element; //drawParams.DrawFocusRectangle(uieCell.Rect, Color.White, Color.White); if (uieCell.Cell.Column.ToString() == "Result" && uieCell.Cell.Text != string.Empty) { drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Bottom); // This Line is executing but not drawing line } else if (uieCell.Cell.Column.ToString() == "ResultText" && uieCell.Cell.Text != string.Empty) { drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Bottom); // This Line is executing but not drawing line } } return bReturnvalue; }
First of all thanks for your prompt reply.
I got your suggestion and I really liked but one problem i am facing is line is not displaying. I wrote following code. Can you please check and tell me where i am making mistake?
uieRow is a object of RowUIElement
drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Bottom);
uieRow.DrawElement(ref drawParams);
You would have to use a DrawFilter for this. I would recommend setting BorderStyleCell to None. Then you would use a DrawFilter and trap for the RowUIElement and you can set the BorderSides on the drawParams.
If you are not familiar with DrawFilters, check the Infragistics KB for articles and samples. Also, get the Infragistics UIElementViewer Utility.