Home Forums WinForms controls Xceed Grid for WinForms How to remove borders from cells/rows

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15157 |

    Hi there,

    I created new Datarow and DataCell classes, aiming at removing the borders from the cells and from the rows. Basically, what I want is a blank row between the groups. It’s partially working now as the right, bottom and top borders are no longer being displayed. There is no way I can get rid of the left border though. I have tried drawing lines, etc.. My code is attached below.. Please advice.

    Thanks,
    Lauro

    ——————————————————
    BlankRow _blankRow = new BlankRow();
    this.group2.FooterRows.Add(this._blankRow);

    public class BlankRow: Xceed.Grid.DataRow
    {
    public BlankRow(): base()
    {
    this.ShowPlusMinus = ShowPlusMinus.Never;
    this.Indented = false;
    this.ShowTreeLine = false;
    this.CanBeCurrent = false;
    this.CanBeSelected = false;

    }

    protected BlankRow( BlankRow template ): base( template )
    {
    }

    protected override Row CreateInstance()
    {
    return new BlankRow( this );
    }

    // Necessary only if you want to use your row in the Grid Designer
    public BlankRow( RowSelector rowSelector ):base( rowSelector )
    {
    }

    protected override Cell CreateCell( Column parentColumn )
    {
    return new BlankCell( parentColumn );
    }

    protected override void PaintBorders(Xceed.Grid.GridPaintEventArgs e)
    {

    }

    }

    public class BlankCell : DataCell
    {
    protected BlankCell( BlankCell template ): base( template )
    {
    }

    public BlankCell( Column parentColumn ): base( parentColumn )
    {
    this.BackColor = this.ParentColumn.ParentGrid.BackColor;
    }

    protected override Cell CreateInstance()
    {
    return new BlankCell( this );
    }

    protected override void PaintBorders(Xceed.Grid.GridPaintEventArgs e)
    {

    }

    }

    Imported from legacy forums. Posted by lauro.costa (had 4092 views)

    User (Old forums)
    Member
    Post count: 23064

    Instead of overriding the PaintBorders method, try overriden the Borders property, like this:<pre>static readonly fBorders = new Borders(0, 0, 0, 0);
    public override Borders Borders { get { return fBorders; } }</pre>

    Imported from legacy forums. Posted by Tommy (had 331 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks Tommy, That works exactly the same as mine.. I can still see the left border, though.

    I think this border belongs to the group, so maybe the solution would be to override Xceed.Grid.Group .. By doing so, I would have to override GroupList so I could add some new methods to match my new Group class and also I would have to override the Grid so GroupTemplates would be type of the new GroupList I have just created ..

    I have tried doing stuff on group2.SideMargin.Paint, but it doesn’t work to remove the borders..

    Could someone tell me if it’s possible to remove the borders of the groups Xceed.Grid.Group?

    Thanks,
    Lauro

    Imported from legacy forums. Posted by lauro.costa (had 407 views)

    User (Old forums)
    Member
    Post count: 23064

    We think it is more the right border of the RowSelectorPane/RowSelector that you still see. You can quickly test if this is the case by setting the RowSelectorPane.Visible property to false. If it works, then you’ll know the direction you need to take. 🙂

    Imported from legacy forums. Posted by André (had 252 views)

    User (Old forums)
    Member
    Post count: 23064

    you are sort of right.. that’s the right border of the grid side margin.. GridControl.SideMargin.Borders

    One way to get rid of it would be to set the side margin width to 0, but in that case, as I have groupings and detail grids, I would be unable to collapse/expand the detail grid..

    I tried to set RowSelectorPane/RowSelector.Visible to false but it didn’t work.

    Imported from legacy forums. Posted by lauro.costa (had 431 views)

    User (Old forums)
    Member
    Post count: 23064

    You will need to create a custom GroupMargin, in which you will do the usual overriding stuff, plus override the Borders, as you did in the row/cell derivation.

    Then you will use this custom GroupMargin on the group that serves as a template to the GroupByRow GroupTemplate.

    i.e.: GroupByRow.GroupTemplate = new Group( new myGroupMargin() );

    Imported from legacy forums. Posted by André (had 5025 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.