C1RibbonForm - set border color

Posted by: c1 on 28 February 2019, 4:22 am EST

    • Post Options:
    • Link

    Posted 28 February 2019, 4:22 am EST

    Hello folks,

    i am using C1RibbonForm at my application.

    This component shows a blue ‘shinning’ border at the sample application ‘FlexReportExplorer’. A new build C1RibbonApplication shows a red border.

    How can I set/change the Color of this border. I like to switch from green to red, if the user have unsaved data.

    Thanks for any help.

    Niels

  • Posted 1 March 2019, 7:22 am EST - Updated 4 October 2022, 1:29 am EST

    Hi Niels,

    It seems that you are referring to the color taken by the form by-default with themes or Visual Styles.

    With “FlexReportExplorer” sample, the C1DockingTab “dockTabPagePreview” on the left has its “VisualStyle” property set to “Office2007Blue” and hence, appears to have a blue border at that corner.

    You can also set the “Visual Styles” property of the form to set a required color. However, there is no direct Color related property to set the form border color. Further, to use themes, refer the below mentioned documentation link:

    https://help.grapecity.com/componentone/NetHelp/c1themes/webframe.html#QSApplyingBuiltInThemetoApp.html

    Note that you can create your own theme and set its Ribbon form related ActiveBordercolor and InactiveBorderColro related properties in the C1ThemeDesigner. Learn to create a theme from here:

    https://help.grapecity.com/componentone/NetHelp/c1themes/webframe.html#QSCreatingaCustomTheme.html

    Best Regards,

    Esha

  • Posted 4 March 2019, 8:09 am EST

    Hello Esha,

    thank for your answer and pointing me to a interesting feature of C1RibbonForm (C1ThemeController and C1ThemeDesigner.4.exe).

    In this case I found a smaller solution to change the bordercolor of a ribbonform. I analyse the code from the default C1RibbonForm-Application and use this.

    Public Class MainRibbonForm
      Private _themeColor As ThemeColor = ThemeColor.Orange
      Private _themeLightness As ThemeLightness = ThemeLightness.LightGray
      Private _childForm As ChildRibbonForm = Nothing
    
      Public Sub New()
        MyBase.New()
        InitializeComponent()
    
        RibbonStyle.UpdateInstance(_themeColor, _themeLightness)
      End Sub
    
      Private Sub cmdRed_Click(sender As Object, e As EventArgs) Handles cmdRed.Click
        _themeColor = ThemeColor.Red
        RibbonStyle.UpdateInstance(_themeColor, _themeLightness)
        _childForm.setBorder(_themeColor, _themeLightness)
      End Sub
    
      Private Sub setGreen_Click(sender As Object, e As EventArgs) Handles setGreen.Click
        _themeColor = ThemeColor.Green
        RibbonStyle.UpdateInstance(_themeColor, _themeLightness)
        _childForm.setBorder(_themeColor, _themeLightness)
      End Sub
    
      ' Create a Child-Form
      Private Sub MainRibbonForm_Load(sender As Object, e As EventArgs) Handles Me.Load
        _childForm = New ChildRibbonForm()
        _childForm.MdiParent = Me
        _childForm.Show()
      End Sub
    
    End Class
    

    But, after solving one problem a other problem raised :slight_smile:

    Because of the default backgroundcolor of the inner section of a mdi-parent-form the bordercolor of childs is not clear enough. (see attached project)

    Do you know a way to change this color to white? I don’t find this property at C1ThemeDesigner.4.exe.

    Thanks in advance for any help.

    Niels

    RibbonForm_MDI.zip

  • Posted 5 March 2019, 2:56 am EST - Updated 4 October 2022, 1:29 am EST

    Hello Niels,

    The BackColor of the MDI form can be changed using the following line of code in the Load event of MainRibbonForm:

    Controls.OfType(Of MdiClient).FirstOrDefault.BackColor = Color.White
    
    

    I have attached the modified application for your reference.

    Regards,

    Esha

    RibbonForm_MDI_mod.zip

  • Posted 5 March 2019, 12:00 pm EST

    Hello Esha,

    thanks a lot for your solution.

    Thanks for your answer to a off topic aspect (because this is not related to a c1 component).

    After putting my own code into my project I recognize that this fullfill my requirements only for 75%. I get some sideeffects. Setting the border red set all borders red (not only from one mdi-client). Together with changing the border i get changes on the background color off ribbonbuttons and closebutton of the window. It seems to me that we have only one instance of thememanager and changes on this will change the theme for all windows - right?

    Ok - I can live with this behavior, or is there an easy way to solve this?

    Thanks for your detailed supportwork at my topic.

    Niels

  • Posted 6 March 2019, 2:55 am EST - Updated 4 October 2022, 1:29 am EST

    Hi Niels,

    >>Together with changing the border i get changes on the background color off ribbonbuttons and closebutton of the window.

    This might occur because the newly applied theme has different properties for these controls or its existing properties are not in sync with the default properties as per the theme.

    One theme is applied to the application but you can always choose where to apply the theme i.e. you can set Theme property to none for certain controls, as in the attached screenshot. Here, the selected theme is not applied to the form and the ribbon, as per the value we specify in the C1ThemeController dialog opened on clicking “Set themes”. This has also been shown in this documentation link:

    https://help.grapecity.com/componentone/NetHelp/c1themes/webframe.html#C1ThemeControllerDialogBox.html

    This can be done by code, as follows:

        c1ThemeController1.SetTheme(c1Ribbon1, "(none)");
    
    

    Note that this applies to the entire control and not just a few parts of it.

    Best Regards,

    Esha

  • Posted 6 March 2019, 3:29 am EST

    Hello Esha,

    thanks for your discription. I will try to understand this concept and try to implement it into my project.

    Once more: Thank you for your good and detailed support.

    Greatings

    Niels

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels