We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Rounded Corners for SfDataGrid, Scrolling Pane & Scroll Bars

Thread ID:

Created:

Updated:

Platform:

Replies:

140921 Nov 14,2018 10:21 AM UTC Nov 15,2018 12:53 PM UTC WinForms 1
loading
Tags: SfDataGrid
Avinash
Asked On November 14, 2018 10:21 AM UTC

Is there in any way to achieve Rounded Corners for SfDataGrid, Scrolling Pane & Scroll Bars ?

Sample image attached for requirement

Attachment: Table_V04_20181114_154740.png_fde7d1cd.zip

Mohanram Anbukkarasu [Syncfusion]
Replied On November 15, 2018 12:53 PM UTC

Hi Avinash, 
 
Thanks for contacting Syncfusion support. 
 
Currently we don’t have support to get rounded corners for SfDataGrid, scrolling pane and scrollbars as per the given image. 
However we can provide a workaround to get the rounded corners only for the SfDataGrid by creating a custom SfDataGrid control.  Please refer to the following code example and sample from the given location. 
 
Code example :  
 
public class CustomDataGrid : SfDataGrid 
{ 
    private int radius = 10; 
    [DefaultValue(10)] 
    public int Radius 
    { 
        get { return radius; } 
        set 
        { 
            radius = value; 
            this.RecreateRegion(); 
        } 
    } 
    
    private GraphicsPath GetRoundRectagle(Rectangle bounds, int radius) 
    { 
        GraphicsPath path = new GraphicsPath(); 
        path.AddArc(bounds.X, bounds.Y, radius, radius, 180, 90); 
        path.AddArc(bounds.X + bounds.Width - radius, bounds.Y, radius, radius, 270, 90); 
        path.AddArc(bounds.X + bounds.Width - radius, bounds.Y + bounds.Height - radius, radius, radius, 0, 90); 
        path.AddArc(bounds.X, bounds.Y + bounds.Height - radius, radius, radius, 90, 90); 
        path.CloseAllFigures(); 
        return path; 
    } 
 
    private void RecreateRegion() 
    { 
        var bounds = new Rectangle(this.ClientRectangle.Location, this.ClientRectangle.Size); 
        bounds.Inflate(-1, -1); 
        using (var path = GetRoundRectagle(bounds, this.Radius)) 
            this.Region = new Region(path); 
        this.Invalidate(); 
    } 
    protected override void OnSizeChanged(EventArgs e) 
    { 
        base.OnSizeChanged(e); 
        this.RecreateRegion(); 
    } 
} 
 
  
Regards, 
Mohanram A. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;