Click here to Skip to main content
15,070,680 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can I define a base form style for all forms using c#?

For example: an banking application containing same background for all the forms and in the background we have an bank image which need to be used in all.

I know processing in asp.net by using Masterpages. Looking some conept implementing it in C#.Net.
Posted

1 solution

Basically you would create your form in the way you wanted it, (call it BaseForm) and then when you add a new form, navigate to Inherited form, and select baseform.

Base form...
C#
public partial class BaseForm : Form
{
      protected BaseForm()
      {
          InitializeComponent();
      }
}



And now the Single Entry From that inherits it.
C#
public partial class SingleEntry : BaseForm
{
      protected SingleEntry()
      {
          InitializeComponent();
      }
}
   
Comments
Mannava Siva Aditya 20-Nov-12 0:54am
   
Thanks Rob! But I would like to inherit the background only! not the controls.
Rob Branaghan 20-Nov-12 4:36am
   
On my base forms I have 3 buttons on mine, but I guess you dont have to have any controls there, just the Background image.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900