Abstract Forms Using WinForms

I am trying to achieve a similar effect in a WinForms application as the main form using ASP.NET. My initial thoughts on this were to create a basic form and declare it abstract, but the compiler does not seem to allow me to do this.

public abstract partial class Master : Form
{
    public Master()
    {
        InitializeComponent();
    }
}

I have two questions:

  • Why won't the compiler let me do this? I am using the wrong syntax or this is a genuine limitation.
  • Can anyone suggest a workaround or a better way to do this?

EDIT:

InitializeComponent Code:

    private void InitializeComponent()
    {
        this.components = new System.ComponentModel.Container();
        this.mainMenu1 = new System.Windows.Forms.MainMenu();
        this.Menu = this.mainMenu1;
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
        this.Text = "Master";
        this.AutoScroll = true;
    }

EDIT:

The error is as follows:

The designer must create an instance of type 'Namespace.Master' but it cannot because the type is declared as abstract.
+3
source share
1 answer

I am trying to achieve a similar effect in a WinForms application as a wizard, the form works with ASP.NET.

Winforms . , UserControls .

, , , - .

public interface IMasterPage
{
 IControlContainer Container { get; }
}

, .

0

Source: https://habr.com/ru/post/1785461/


All Articles