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

Add Minimize,Maximize and Close buttons to telerik RadPanaroma

1 Answer 364 Views
Panorama
This is a migrated thread and some comments may be shown as answers.
Donnie
Top achievements
Rank 1
Donnie asked on 12 Dec 2014, 05:12 PM
Hi

Can anyone please tell me how to add the Minimize , Maximize and close button on the panorama control or form just like the one on the demo.? I've been trying to achieve that for sometime now. I need help.

Thanks

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 15 Dec 2014, 08:50 AM
Hi Donnie,

Thank you for writing.

One way to achieve this is to use RadTitleBar control, and place the title bar and the panorama control is some container (like RadPanel for example). 

The other way to do this is to create an instance of our RadTitleBarElement class, apply the desired settings regarding size and position of the buttons and then add the element to your form or panorama control. Please note that you should also implement the behavior of the Minimize, Maximize and Close buttons:
public partial class Form1 : RadForm
{
    private RadTitleBarElement titleBar;
 
    public Form1()
    {
        InitializeComponent();
 
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        this.ControlBox = false;
        this.SetTitleBar();
    }
 
    private void SetTitleBar()
    {
        this.titleBar = new RadTitleBarElement();
        this.titleBar.FillPrimitive.Visibility = ElementVisibility.Hidden;
        this.titleBar.MaxSize = new Size(0, 30);
        this.titleBar.Children[1].Visibility = ElementVisibility.Hidden;
 
        this.titleBar.CloseButton.Parent.PositionOffset = new SizeF(0, 10);
        this.titleBar.CloseButton.MinSize = new Size(50, 50);
        this.titleBar.CloseButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;
 
        this.titleBar.MinimizeButton.MinSize = new Size(50, 50);
        this.titleBar.MinimizeButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;
 
        this.titleBar.MaximizeButton.MinSize = new Size(50, 50);
        this.titleBar.MaximizeButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;
 
        this.titleBar.CloseButton.SetValue(RadFormElement.IsFormActiveProperty, true);
        this.titleBar.MinimizeButton.SetValue(RadFormElement.IsFormActiveProperty, true);
        this.titleBar.MaximizeButton.SetValue(RadFormElement.IsFormActiveProperty, true);
 
        this.titleBar.Close += new TitleBarSystemEventHandler(titleBar_Close);
        this.titleBar.Minimize += new TitleBarSystemEventHandler(titleBar_Minimize);
        this.titleBar.MaximizeRestore += new TitleBarSystemEventHandler(titleBar_MaximizeRestore);
 
        this.radPanorama.PanoramaElement.Children.Add(titleBar);
    }
 
    private void titleBar_MaximizeRestore(object sender, EventArgs args)
    {
        if (this.WindowState != FormWindowState.Maximized)
        {
            this.WindowState = FormWindowState.Maximized;
        }
        else
        {
            this.WindowState = FormWindowState.Normal;
        }
    }
 
    private void titleBar_Minimize(object sender, EventArgs args)
    {
        this.WindowState = FormWindowState.Minimized;
    }
 
    private void titleBar_Close(object sender, EventArgs args)
    {
        Application.Exit();
    }
}

I hope that this information helps. Should you have further questions please do not hesitate to ask.


Regards,
Hristo
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Panorama
Asked by
Donnie
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or