How can I turn off the verticle grid lines? I have one band and I only want the horizontal grid lines to show.
Normally I would search the forums for an answer but that doesn't seem to be working.
Hello,
You can set the BorderStyleCell to None and this will remove the vertical lines. The following code accomplishes this:
this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = UIElementBorderStyle.None;
Alan
this works fine with vertical lines. But how to hide the horizontal lines?
Thank you very much!
Hei,
I have managed to get horizontal lines and not vertical lines but, i want to remove the small lines on the right side, see picture. (There are similar lines on the left side). (and i as you can see on the picture want do dispaly the line for every second row)
The code i use for this is:
grdReport.DisplayLayout.Override.BorderStyleRow =
UIElementBorderStyle.Solid
grdReport.DisplayLayout.Override.BorderStyleCell =
UIElementBorderStyle.None
For
Each ultRow As UltraGridRow In grdReport.Rows
If i Mod 2 = 0 Then
ultRow.Appearance.BorderColor =
Color.Black
ultRow.Appearance.BackColor = Color.LightGray
i += 1
Next
As has been mentioned before, the objects in the grid do not draw all 4 border sides. So in the image you have here, each row is drawing it's top and right border (and maybe also Left), but not the bottom. It relies on the row below it for it's bottom border (except for the last row, of course).
You would have to use a DrawFilter to get any finer control over the borders here. What you would have to do is trap for the RowUIElement's BeforeDrawBorders phase. You could use GetContext to get a reference to the row and then use the IsAlternate property to decide if you want to handle the border drawing.
Then you would use DrawParams.DrawBorders and use one of the overloads that takes in the BorderSides so you can specify which sides to draw and return true to tell the grid not to draw the borders.
Hi,
So now i want to make a print preview of the grid, but because i am using the drawfilter to modify the border the border wont show in the print preview document! [1]
So how to modify the border so that i also will be in the print preview??? I code example would be appreciated...
[1] http://blogs.infragistics.com/forums/p/28519/121078.aspx
The DrawFilter code will be called again when you print the grid, but you have to be careful, because the graphics object for the printer uses different units than the one on the screen. So my guess is that the coordinates you are using when you draw the borders are incorrect on the printer.
It's hard for me to provide you with an example, since I don't really know what you are trying to do here.
You may want to consider setting the CellPadding property on the grid.DisplayLayout.Override. This will create a space between the cells in the grid so that each cell draws it's own borders and then you can simply use the cell.Appearance.BorderColor property.
If that's no good, then post a small sample project demonstrating what you are doing and I will take a look and see if I can determine how to make it work in the print preview.
HI,
I tried to export the grid to and pdf, as you can see the drawfilter is not used in the pdf exporter. I have created a simple example. Please help me modify it so that it will display the 2 lins on the grid also in the pdf export...
Sutha,
Which picture are you referring to, there wasn't a picture in your post and there are many in this thread from before. Please provide an image that shows that you are looking for or what you want to change.
hi, But i need a border for heading also, how is there in above picture same way with all rows border also.
Plz help me
Regards
Sutha
Hi Fredrik,
You would basically have to duplicate the same code in the RowExported event of the UltraGridDocumentExporter and modify the properties of the report row borders. Something like this:
Private Sub expPdfExporter_RowExported(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.DocumentExport.RowExportedEventArgs) Handles expPdfExporter.RowExported Dim row As UltraGridRow = e.GridRow If lstUnderLine.ContainsKey(row.Index) Or lstOverLine.ContainsKey(row.Index) Then ' This will only be called for the BeforeDrawBorders phase of a ' RowCellAreaUIElement based on the flags returned from GetPhasesToFilter. ' Draw a border along the top edge of the element. e.ReportRow.Borders = New Infragistics.Documents.Report.Borders(Nothing, Nothing, Infragistics.Documents.Graphics.Pens.Black, Nothing) 'if it is the last row draw a line at the bottom If row.HasNextSibling = False Then e.ReportRow.Borders = New Infragistics.Documents.Report.Borders(Nothing, Nothing, Infragistics.Documents.Graphics.Pens.Black, Infragistics.Documents.Graphics.Pens.Black) End If End If End Sub
So is there another way of doing it then? Creating the horizontal lines over and under the text without using the drawfilter? SO that it will apare in the pdf export?
greeting,
fredrik
A DrawFilter will apply when printing the grid, because the grid actually draws itself onto the printer's graphics object.
But this is not the case for exporting. The grid does not draw itself onto any graphics objects in PDF, it creates a PDF structure that matches itself. So the DrawFilter will not apply.
I don't beleive there is any way to do this in the PDF export.