First of all I am working with Visual Studio 2017. I have create a UserControl which requires a borderless form. Is there any way to popup a message if programmer try to place this control into a non-borderless form? Something like the message box which appears in design view when we give a wrong value at Properties Window of any control.
EDIT
I noticed that if I add a simple MsgBox into my UserControl's Public Sub New and then add this UserControl to a Form, message box appears.
Public Sub New()
InitializeComponent()
MsgBox("Test Message")
End Sub
But, how can I check if parent form is borderless or not? Something like this example below, which of course doesn't work inside Public Sub New because there is no parent yet!!!
Public Sub New()
InitializeComponent()
if Not MyBase.ParentForm.FormBorderStyle = FormBorderStyle.None Then
MsgBox("Test Message")
End If
End Sub
OnParentChangedmethod, which raises theParentChangedevent whenever the control is added to another control. - jmcilhinneyOnParentChangedwill execute when a control is removed from another control, so be sure to check thatParentisn'tNothingfirst. - jmcilhinney