RadForm custom add RadTitleBar

5 posts, 0 answers
  1. jiang
    jiang avatar
    7 posts
    Member since:
    Apr 2019

    Posted 25 Apr Link to this post

    I want to add RadTitleBar to the RadForm, so I'v created a RadTitleBarElement variable, how do i add it to RadForm(FormElement)?

    My goal is to add a close, minimize, and maximize function  to the RadForm.

     

     public RadForm1()
            {
                InitializeComponent();

                
                titleBar = new RadTitleBarElement();

                titleBar.FillPrimitive.Visibility = ElementVisibility.Hidden;
                titleBar.MaxSize = new Size(0, 30);
                titleBar.Children[1].Visibility = ElementVisibility.Hidden;
                titleBar.AllowResize = false;
                titleBar.CloseButton.Parent.PositionOffset = new SizeF(0, 0);
                titleBar.CloseButton.MinSize = new Size(10, 10); 
                titleBar.CloseButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;

                titleBar.MinimizeButton.MinSize = new Size(10, 10);
                titleBar.MinimizeButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;

                titleBar.MaximizeButton.MinSize = new Size(10, 10);
                titleBar.MaximizeButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;

                titleBar.CloseButton.SetValue(RadFormElement.IsFormActiveProperty, true);
                titleBar.MinimizeButton.SetValue(RadFormElement.IsFormActiveProperty, true);
                titleBar.MaximizeButton.SetValue(RadFormElement.IsFormActiveProperty, true);
                titleBar.BackColor = Color.Red;
                titleBar.Close += new TitleBarSystemEventHandler(titleBar_Close);
                titleBar.Minimize += new TitleBarSystemEventHandler(titleBar_Minimize);

                titleBar.MaximizeRestore += new TitleBarSystemEventHandler(titleBar_MaximizeRestore);

        
                this.RadFormElement ?????
            }

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3331 posts

    Posted 26 Apr Link to this post

    Hello, Jiang,    

    By default, RadForm has its own title bar. It is not necessary to add it explicitly. Please refer to the following help article: https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/form/form

    You can simply access the already available title-bar and customize its settings: 

    RadTitleBarElement titleBar = this.FormElement.TitleBar;
    //the next part of the code

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. jiang
    jiang avatar
    7 posts
    Member since:
    Apr 2019

    Posted 27 Apr in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi, Dess | Tech Support Engineer, Sr.

    Thanks for your reply,  this is my first time using Telerik UI for Winform, I don't know how to do it like in the pictures.

    Can I set properties of  RadTitleBar?

  4. jiang
    jiang avatar
    7 posts
    Member since:
    Apr 2019

    Posted 27 Apr Link to this post

    this is a picture
  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3331 posts

    Posted 29 Apr Link to this post

    Hello, Jiang,     

    I have prepared a sample project for your reference demonstrating how to access the title-bar and manipulate its properties. 

    The following help article demonstrates how to access the form's elements: https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/form/accessing-radform-elements

    You can also use RadControlSpyForm which is quite convenient for inspect elements at run time. The following help articles demonstarte how to use it: 
    https://docs.telerik.com/devtools/winforms/tools/controlspy/adding-the-control-spy-to-your-application
    https://docs.telerik.com/devtools/winforms/tools/controlspy/inspecting-properties

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top