Reputation: 2106
The majority of my forms for my project include an OK and Cancel button. (always positioned at the bottom right of the form). Currently I have a base class that inherits from System.Windows.Forms which contains an OK and Cancel button. All forms that use this then inherit from this base form class. Is there a better way of doing this that takes localization into consideration?
Upvotes: 0
Views: 338
Reputation: 101
Doing form inheritance is very useful in many levels:
Hope this being useful for you.
Upvotes: 1
Reputation: 164
You could just create a single form that has an empty panel or table layout, where you dynamically load the desired user control. It is basically the composition over inheritance principle.
public partial class MyFormWithButtons : Form
{
public MyFormWithButtons(UserControl control)
{
InitializeComponent();
control.Dock = DockStyle.Fill;
myPanel.Controls.Add(control);
}
}
Upvotes: 1
Reputation: 56
I would use MDI Child Forms for this. Parent Form Can contain OK/Cancel button where as you would have your child form in MDI container.
For More help visit https://msdn.microsoft.com/en-us/library/aa984329(v=vs.71).aspx
Upvotes: 1