This is a migrated thread and some comments may be shown as answers.

RadForm custom add RadTitleBar

4 Answers 224 Views
TitleBar
This is a migrated thread and some comments may be shown as answers.
jiang
Top achievements
Rank 1
jiang asked on 26 Apr 2019, 04:42 AM

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 ?????
        }

4 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 26 Apr 2019, 11:40 AM
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.
0
jiang
Top achievements
Rank 1
answered on 28 Apr 2019, 04:17 AM

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?

0
jiang
Top achievements
Rank 1
answered on 28 Apr 2019, 04:19 AM
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Apr 2019, 11:23 AM
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.
Tags
TitleBar
Asked by
jiang
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
jiang
Top achievements
Rank 1
Share this question
or