Adding menus or other controls to the TitleBar

Hi experts

I'm doing the design of the application and want to transfer MenuStrip (I use the menu as there are sub-items but I don't know how to make an arrow if there are items) and SfConboBox on the TitleBar, I create a FlowLoyoutPanel and add controls to it.

FlowLayoutPanel menuPanel = new FlowLayoutPanel();
menuPanel.Controls.Add(msMainMenu);
menuPanel.Controls.Add(cbLaboratory);
cbLaboratory.Height = 20;
cbLaboratory.Anchor = AnchorStyles.Right;
int size = msMainMenu.Width + cbLaboratory.Width + 40;
menuPanel.Size = new Size(size, 25);
//Put menu in title bar
this. TitleBarTextControl = menuPanel;

But there are several problems that I do not know how to solve:

1. How to make the panel be created the size of the TitleBar and there is no indentation (painted over the background so that it is visible how the panel is created).

2. How to make the buttons stand out as standard onka buttons (close, expand, hide) so that the selection is the size of the TitleBar.


If there are more correct controls or a method of how to do as I want, I will be glad to have your help.

I attach a photo of my design that I developed and how I was able to do it.


Attachment: image_b1818cfc.zip

5 Replies

SS Sampathnarayanan Sankaralingam Syncfusion Team March 14, 2022 07:33 PM UTC

Hi Azmus


How to make the panel be created the size of the TitleBar and there is no indentation (painted over the background so that it is visible how the panel is created).

You can load the panel to the size of the titlebar by setting the size to the `SfForm.TitleBarTextControl.Size`. And to provide indentation or padding to the `TitleBarTextControl`, you need to set the padding to `SfForm.Style.TitleBar.Padding`. Please find the code snippet below.

 

FlowLayoutPanel menuPanel = new FlowLayoutPanel();

 

// To set the padding.

this.Style.TitleBar.Padding = new Padding(0, 0, 0, 0);

menuPanel.Controls.Add(this.menuStrip1);

menuPanel.Controls.Add(this.comboBox1);

this.comboBox1.Height = 50;

this.comboBox1.Anchor = AnchorStyles.Right;

int size = this.menuStrip1.Width + this.comboBox1.Width + 40;

 

menuPanel.Size = new Size(size, 25);

//Put menu in title bar

this.TitleBarTextControl = menuPanel;

//To size of the control.

this.TitleBarTextControl.Size = new Size(this.menuStrip1.Width + this.comboBox1.Width + 40, 33);

 

Please let us know if you have any concerns.

How to make the buttons stand out as standard onka buttons (close, expand, hide) so that the selection is the size of the TitleBar.

We suspect that you are looking to add the button in the title bar. You can make the button to the size of the title as shown in the code snippet above. We suggest you to use the SfButton Control to achieve the requirement and also you can add image to the SfButton. Please refer the below UG for more details.

 

UG : https://help.syncfusion.com/windowsforms/button/appearance#image

 

If we misunderstand your requirement, please provide us more details with the video illustration. It will be more helpful for us to provide you the prompt and timely solution.


Regards,

Sampath Narayanan.S



DS Denis Schneider March 17, 2022 11:10 PM UTC

Hi, I found a bug, if you specify Maximized in the form builder for WindowState then the panel with the menu and buttons disappears and if you specify Normal all works, I need exactly Maximized.



SS Sampathnarayanan Sankaralingam Syncfusion Team March 18, 2022 04:16 PM UTC

Hi Azmus, 
 
We are validating the reported issue. We will validate and update you with more details on March 22, 2022. 
 
Regards, 
Sampath Narayanan.S 



SS Sampathnarayanan Sankaralingam Syncfusion Team March 22, 2022 02:57 PM UTC

  
Hi Azmus,  
 
We have created bug report for the reported issue “TitleBarTextControl disappears when SfForm's WindowState is set as Maximized on initial loading”. We will fix this issue and include in our upcoming Weekly NuGet release scheduled for April 12, 2022.  

You can track the status of this report through the following feedback link, 
 
 
Note: The provided feedback link is private, and you need to login to view this feedback.

We appreciate your patience until then. 
 
 
Regards,  
Sampath Narayanan.S  
  



DM Dhanasekar Mohanraj Syncfusion Team April 12, 2022 01:47 PM UTC

Hi Azmus,

We would like to let you know that Essential Studio Weekly NuGet packages (v20.1.0.48) has been published in nuget.org with the fix for the issue “TitleBarTextControl disappears when SfForm's WindowState is set as Maximized on initial loading”. Please let us know if you have any concerns in this.


Regards,
Dhanasekar M.


Loader.
Up arrow icon