reusing winforms in .NET CF

  • Thread starter Thread starter vishal garg
  • Start date Start date
V

vishal garg

Hi,
I am working on a GUI intensive application on .NET Cf in
C#. Most of my forms have very similar controls and
appearance. I have around 5 screens and want to use one
base form for all these screens and then customize this
form dynamically for each screen.

Please suggest me a suitable approach for the design.
Any pointers for sample applications will be very helpful.

Regards,
Vishal.
 
What you could do is create a form with all shared
controls on it and derive other forms from it for your
specific screens. Even though Form inheritance is not
supported in the designer you can make use of it in code.

You might be able to use this approach to get some
designer experience, thanks to a post of Roberto M. Oliva
a few months ago:

-----------------------------------------------------
Well, though it is not suported on the designer you have
some workarounds.
For example what I do is the following:
- Define a preprocessor directive, for example: _DESIGNER
= 1
- Change the form code the following way:

Public Class frmForm
#if _DESIGNER = 1 Then
Inherits System.Windows.Forms.Form
#Else
Inherits frmBase
#End if

....
End Class

Then when you need to open the form to design it, you
have to, prior to it,
put the _DESIGNER equals to 1.
Then when you need to compile the code, close all design
view of the forms,
and put the _DESGINER variable to 0

For me it works great!

Roberto
----------------------------------------------------

Regards,

Maarten Struys, eMVP
PTS Software bv
 
Back
Top