Chart for .NET / User's Guide / Layout / Content Panels / Margins and Padding

In This Topic
    Margins and Padding
    In This Topic

    Each content panel has two properties called Margins and Padding that allow you to control how the border is offset from the panel bounds as well as how the panel content is offset from the border respectively.

    The following image shows a numeric display panel with margins, border and padding of 10pt each:

    Note: The margins area on the above picture is intentionally set to blue in order to be visible.

    The following code shows how to set the margins and padding to 10pt from each side:

    C#
    Copy Code
    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();
    numericDisplay.BorderStyle = new NEdgeBorderStyle();
    numericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.LightGray);
    numericDisplay.Margins = new NMarginsL(10, 10, 10, 10);
    numericDisplay.Padding = new NMarginsL(10, 10, 10, 10);
    numericDisplay.Value = 123456.789;
    nChartControl1.Panels.Add(numericDisplay);
    
    Visual Basic
    Copy Code
    Dim numericDisplay As New NNumericDisplayPanel()
    numericDisplay.BorderStyle = New NEdgeBorderStyle()
    numericDisplay.BackgroundFillStyle = New NColorFillStyle(Color.LightGray)
    numericDisplay.Margins = New NMarginsL(10, 10, 10, 10)
    numericDisplay.Padding = New NMarginsL(10, 10, 10, 10)
    numericDisplay.Value = 123456.789
    NChartControl1.Panels.Add(numericDisplay)
    
     Related Examples

    Windows Forms: All Examples\Dashboard Gallery\Financial Dashboard

    Web Forms: All Examples\Dashboard Gallery\Financial Dashboard