don't add panels in DesignMode

This commit is contained in:
Pilzinsel64
2025-01-14 09:35:46 +01:00
parent 45c85e4ced
commit 8092e37312
2 changed files with 14 additions and 9 deletions

View File

@@ -194,7 +194,7 @@ public partial class RadFlyoutBase : UserControl
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
if (!addedControlsToUi) if (!addedControlsToUi && !DesignMode)
{ {
SuspendLayout(); SuspendLayout();
Controls.Add(tableLayoutPanel_ActionPanel); Controls.Add(tableLayoutPanel_ActionPanel);

View File

@@ -1,11 +1,12 @@
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Security.Policy;
namespace Pilz.UI.Dialogs; namespace Pilz.UI.Dialogs;
public partial class FlyoutBase : UserControl public partial class FlyoutBase : UserControl
{ {
private bool addedControlsToUi;
protected TableLayoutPanel tableLayoutPanel_TitlePanel; protected TableLayoutPanel tableLayoutPanel_TitlePanel;
protected Label label_Title; protected Label label_Title;
protected TableLayoutPanel tableLayoutPanel_ActionPanel; protected TableLayoutPanel tableLayoutPanel_ActionPanel;
@@ -164,6 +165,8 @@ public partial class FlyoutBase : UserControl
} }
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{
if (!addedControlsToUi && !DesignMode)
{ {
SuspendLayout(); SuspendLayout();
Controls.Add(tableLayoutPanel_ActionPanel); Controls.Add(tableLayoutPanel_ActionPanel);
@@ -172,6 +175,8 @@ public partial class FlyoutBase : UserControl
tableLayoutPanel_TitlePanel.SendToBack(); tableLayoutPanel_TitlePanel.SendToBack();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
addedControlsToUi = true;
}
base.OnLoad(e); base.OnLoad(e);
} }