|I'm trying to create a CustomBorderlessForm and paint myself. I've gotten the basic functionality
to work but have this issue.
I have derived a TestForm from the custom BorderlessForm and when dropping a menustrip
or toolstrip onto the TestForm, these controls dock at the top of the form overlaying
the title area which I draw myself. I have tried a number of solutions with no success
and now I am just trying to do the simplest thing I can think of.
I have created a property on the BorderlessForm to Enable or Disable showing a MenuStrip.
When Enabled on the derived TestForm, I create a MenuStrip and place it on the TesForm at a specific location.
This works but I cannot edit the MenuStrip from the Designer. Below is code for a custom
ParentControlDesigner in which I am trying to EnableDesignMode to allow editing of the MenuStrip.
However it still does not work.
I have tried debugging into BorderlessFormDesigner below but the Designer does not hit the break point within Initialize(). To do this I have setup the project in MyProject to execute a new instance of VS and load the project. Within the new instance of VS I open the TestForm in the Designer but the Designer does not hit the break point. I've tried setting a break point in both the
first and second instance.
I've done this sort of thing before with other projects with success. I'm guessing maybe these
controls to not support this type of functionality.
If this is possible I would appreciate some advice.
Here is the code excluding the BorderlessForm.Designer.vb code.
Public Class BorderlessForm
Const ConstGridBorderlessTitle As String = "BorderlessForm"
Private _MenuStrip As MenuStrip
Public ReadOnly Property MenuStrip1() As MenuStrip
DefaultValueAttribute(GetType(Boolean), "False"), _
DescriptionAttribute("Show/hide MenuStrip.")> _
Public Property EnableMenuStrip() As Boolean
Return (Me._MenuStrip IsNot Nothing)
Set(ByVal value As Boolean)
If value = True Then
If Me._MenuStrip Is Nothing Then
Me._MenuStrip = New MenuStrip()
Me._MenuStrip.BackColor = Color.LightSteelBlue
Me._MenuStrip.Dock = DockStyle.None
Me._MenuStrip.Location = New System.Drawing.Point(6, 24)
Me._MenuStrip.Name = "BFMenuStrip"
Me._MenuStrip.Size = New System.Drawing.Size(336, 24)
Me._MenuStrip.TabIndex = 0
Me._MenuStrip.Text = "BFMenuStrip"
ElseIf Me._MenuStrip IsNot Nothing AndAlso Me.Controls.Contains(Me._MenuStrip) = True Then
Me._MenuStrip = Nothing
Public Class BorderlessFormDesigner
Private HostControl As BorderlessForm = Nothing
Private ActionUiService As DesignerActionUIService = Nothing
Public Overrides Sub Initialize(ByVal component As System.ComponentModel.IComponent)
If Me.Control Is BorderlessForm Then
HostControl = DirectCast(component, BorderlessForm)
modified 30-Jan-20 13:16pm.