Docked Controls In Client Area End Up On Top Of TitleBar

Windows 10 / VS 2019 Community / Syncfusion Community Edition / VB.Net / WinForms

I've created an sfForm. All is well unless I have a control docked to Fill, Left or Right. The control then covers the TitleBar. Is this normal? I need a text editor control docked to fill in the client area. I was hoping to place the MenuStrip in the TitleBar. Images from designer and at runtime are attached.

Attachment: sfFormIssue_ac41a762.zip

11 Replies

SS Susmitha Sundar Syncfusion Team April 20, 2020 12:21 PM UTC

Hi Alan, 
 
Thank you for using Syncfusion controls. 

We were unable to replicate your reported issue. We have prepared the sample for your reference.  


 

We have tested with Syncfusion version 18.1.0.36. 

Please check the sample and let us know if you still facing the same issue? If not, please modify the sample based on your scenario and revert us back with the following details, 

·       Syncfusion update version 
·       SfForm customization 

It will be helpful for us to check on it and provide you the solution at the earliest.   

Regards, 
Susmitha S 



PR Padmini Ramamurthy Syncfusion Team April 21, 2020 04:18 AM UTC

From: Alan Burkhart 
Sent: Monday, April 20, 2020 9:29 PM
To: Syncfusion Support <[email protected]>
Subject: Re: Syncfusion support community forum 153457, Docked Controls In Client Area End Up On Top Of TitleBar, has been updated. 
  
Looks like I made some mistakes converting example code from C# to VB (I don't know much about C#). I've downloaded a VS converter extension and converted your demo project to VB. I should be able to figure it out from here. Thank you for the assistance. 
 
Nothing sways the stupid more than arguments they can't understand. - Cardinal de Retz 
 



SS Susmitha Sundar Syncfusion Team April 22, 2020 09:18 AM UTC

Hi Alan, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Susmitha S 



AB Alan Burkhart April 23, 2020 12:41 AM UTC

I had assumed that I'd solve the problem, but it still exists. I have attached a simple project to illustrate. The project includes a windows form converted to an sfForm. A user control is added to the titlebar, and a RichTextBox in the client area. If I add the usercontrol to the titlebar, the richtextbox moves upward to cover the titlebar (compare its position at runtime to the designer). But if I do not use the usercontrol, the richtextbox does not move. If the richtextbox is docked to fill AND the usercontrol is used, the rtb covers the titlebar. If I do not use the control, the rtb behaves as expected. It's probably something I'm doing wrong, but I'm lost here. There is an error log text file in the project but I do not fully understand what it says. Any help is appreciated. Thanks.

Attachment: SyncfusionsfFormIssue_2_15493125.zip


SS Susmitha Sundar Syncfusion Team April 23, 2020 03:10 PM UTC

Hi Alan, 

Thank you for the update. 

We were able to replicate your reported issue from our end. We will validate and update you the details on or before April 27, 2020.   
   
We appreciate your patience until then.   
   
Regards,   
Susmitha S   



SS Susmitha Sundar Syncfusion Team April 27, 2020 04:05 PM UTC

Hi Alan, 
 
Thank you for your patience. 
 
We have validated the reported issue. While TitlebarTextControl is used, we have taken the entire form as client area and the title bar will be drawn in the client area. So that we can add the control in the Titlebar.  
Here you want to dock the control, But the behavior of the docking is to fill the entire client area thus the control covers the Titlebar. Meanwhile, you want to load the MenuStrip in Titlebar which is also impossible since the behavior of MenuStrip is to dock in top of the client area which will disappear the Form buttons.  
So, can you please share your exact requirement, we will provide the solution based on that.  
 
Regards, 
Susmitha S 
 



AB Alan Burkhart April 27, 2020 06:11 PM UTC

That explains my problem then. I was not aware that the titlebar was a part of the client area. I've coded a possible workaround that I'm happy to share if you're interested in it. I created a Windows Form and made it borderless, then set its padding at 5pixels (for a border). I added a derived class from Panel (double buffered) to serve as a titlebar, docked to the top. A second 2x buffered panel is docked to fill below it. This serves as a client area. I don't dock the menustrip to Top. I dock it Left so it's not in the way.

I can listen to mouse events for the top panel and the edges of the form (because of the padding) for moving the window via the top panel and resizing it via the form's edges. It works well except that even with every control double buffered, I still get a lot of flicker. The form simply doesn't redraw fast enough to keep up. If I can resolve this issue then I'll have a nice custom form for Winforms. If not I may have to learn UWP, which I do not wish to do.

Thank you for your help. If at some point this issue is resolved I'll be happy to try the sfForm again. You have great products.


AB Alan Burkhart April 27, 2020 07:54 PM UTC

UPDATE...
Added a Panel control to the sfForm and docked it to the bottom. All client area controls inside it (edit control, StatusStrip and ToolStrip). Then I handle the forms Resize event and set the Panel's height to form.height-(titlebar.height+10). This keeps the panel below the titlebar. Don't know why the extra 10 pixels are needed. Aside from just the tiniest bit of "shiver and quiver" from the edit control (ScintillaNet), it works fine. You guys can probably make this work better than me so thought I'd pass it along.

Partial Public Class Form1
    Public Sub New()
        InitializeComponent()

        Me.TitleBarTextControl = New UserControl1
    End Sub

    Private Sub Form1_Resize() Handles Me.Resize
        'titlebar height is 35 px
        Panel1.Height = Me.Height - 45
    End Sub
End Class

Attachment: sfFormIssueWorkAround_a44540e.zip


SS Susmitha Sundar Syncfusion Team April 28, 2020 05:14 PM UTC

Hi Alan, 
 
Thank you for your update. 
 
As per your update, you are used the workaround to achieve your requirement. But you are facing the below issues, 
 
1.       You are getting the flickering issue while resizing the window. 
2.       And you need to set the extra 10 pixels to set the Panel Height while resizing. 
Can you please confirm the both, because we are not fully clear with your requirement? 
 
It will be helpful for us to check on it and provide you the solution at the earliest.   
 
Regards, 
Susmitha S 



AB Alan Burkhart April 28, 2020 06:12 PM UTC

When the panel is resized, if I only allow for the height of the titlebar, the client area panel still overlaps the titlebar. I have to subtract an additional amount to keep it underneath. When manually resizing the window with the mouse, there is some flicker, but this is due to the panel adjusting its size. That's likely to be unavoidable since it depends upon the speed at which the computer can redraw the controls. The fewer controls in the client area, the less flicker I see.

This is not a huge issue for me personally. I was looking to save some vertical space in an app I'm building, but did not realize the sfForm's titlebar was in the client area. There's no need for any special effort as far as I'm concerned.



SS Susmitha Sundar Syncfusion Team April 29, 2020 02:32 PM UTC

Hi Alan, 
 
Thanks for the update. 
 
Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Susmitha S 


Loader.
Up arrow icon