Control Not Appearing In TitleBar

I created a new project, converted the C# code in the documentation for the sfForm to VB.net and pasted it in. All I see is a thin vertical white line near the left side of the titlebar. The controls never appear. There are no other controls or code. I just started the project. As the form becomes visible there is a brief flicker as if it is trying to show the control. Here is my code:

Imports Syncfusion.WinForms.Controls

Public Class main
    Inherits SfForm

    Public Sub New()
        InitializeComponent()


    End Sub

    Private Sub main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            'Sets the back color and fore color of the title bar.
            Me.Style.TitleBar.BackColor = Color.Gray
            Me.Style.TitleBar.ForeColor = Color.White

            'Sets the fore color of the title bar buttons
            Me.Style.TitleBar.CloseButtonForeColor = Color.White
            Me.Style.TitleBar.MinimizeButtonForeColor = Color.White
            Me.Style.TitleBar.MaximizeButtonForeColor = Color.White

            'Sets the hover state back color of the title bar buttons
            Me.Style.TitleBar.CloseButtonHoverBackColor = Color.Red
            Me.Style.TitleBar.MinimizeButtonHoverBackColor = Color.DarkGray
            Me.Style.TitleBar.MaximizeButtonHoverBackColor = Color.DarkGray

            'Sets the pressed state back color of the title bar buttons
            Me.Style.TitleBar.CloseButtonPressedBackColor = Color.Gray
            Me.Style.TitleBar.MaximizeButtonPressedBackColor = Color.Gray
            Me.Style.TitleBar.MinimizeButtonPressedBackColor = Color.Gray

            Me.Style.Border = New Pen(Color.Gray, 5)
            Me.Style.InactiveBorder = New Pen(Color.Gray, 5)
            Dim searchPanel As New FlowLayoutPanel()
            Dim searchingLabel As New Label()
            searchingLabel.Text = "Searching"
            Dim searchBox As New TextBox()
            searchPanel.Controls.Add(searchingLabel)
            searchPanel.Controls.Add(searchBox)

            'Loads the searchPanel to the title bar.
            Me.TitleBarTextControl = searchPanel
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
End Class

5 Replies

PM Piruthiviraj Malaimelraj Syncfusion Team March 29, 2018 12:29 PM UTC

Hi Alan, 

Thanks for your interest in Syncfusion products. 

We have analyzed your scenario and suspect that the reported scenario might be occurred due to improper size of FlowLayoutPanel or Titlebar. So, to avoid this scenario, set the proper height for Titlebar or FlowLayoutPanel in your sample project. Please make use of any one of the below suggestions, 
  
Code Snippet: 
'Change the height of the title bar based on the panel height.  
Me.Style.TitleBar.Height = 120 
 
'Change the size of the panel based on the title bar height.  
searchPanel.Size = New System.Drawing.Size(240, 24) 

Sample link: 

please let us know if you have any other queries, 

Regards, 
Piruthiviraj 



AB Alan Burkhart March 30, 2018 04:26 AM UTC

This did not resolve the issue. I created a FlowPanel with 3 controls in the designer and set the TitleBar control property  to it at runtime. Same result. Also the form is resizing itself though I have written no code to do so. The images in the attached zip file demonstrate what I'm seeing.

Attachment: sfForm_TitleBar_Issue_26ccd7aa.zip


MA Mohanram Anbukkarasu Syncfusion Team April 2, 2018 12:35 PM UTC

Hi Alan, 

Thanks for your update. 

We have checked the provided screenshots and tried to reproduce the issue at our end. But unfortunately, we couldn’t able to reproduce the reported issue as described in the screenshot and instead we have faced different behavior as in the below image. In your screenshot, the entire control is not showing in the TitleBar. But controls are added properly but with the extra border at our end.  

 

Please confirm us whether the issue like above image is occurred in your project. If not, please refer to the below attached sample and let us know if we missed any customization from your project. It would be more helpful for us to analyze further on this. 

Sample link: 
http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfFormVBSample785141055 

Regards, 
Mohanram Anbukkarasu. 



AB Alan Burkhart April 3, 2018 01:10 PM UTC

I set the MinimumSize property for the control and this allows it to appear in the TitleBar. But my border is even weirder than yours. And the form resizes itself when it opens. Screenshot attached of form at runtime next to the designer so you can see the difference.

Attachment: sfFormTitleBar_2_30c5498d.zip


MA Mohanram Anbukkarasu Syncfusion Team April 4, 2018 12:52 PM UTC

 
Hi Alan,

Thanks for your update.

We have analyzed and fixed the issue of displaying white line on the top and left side of the TitleBar control. This fix will be available in our upcoming release.

We have checked the provided screenshot. The resizing of form may be occured based on the values set for the below properties.

1. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

This causes the form to resize based on the font used.

2. this.MinimumSize = new Size(400, 100);

The resizing will occurs when MinimumSize property value is smaller than Size property of the form.

Remove these lines of code from your project and check.

For more information please refer this thread - https://stackoverflow.com/questions/14875325/why-is-my-form-being-resized-when-it-is-displayed

Please let us know, if you have any other queries.

Regards,
Mohanram Anbukkarasu. 


Loader.
Up arrow icon