reusing winforms in .NET CF

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.
 
M

Maarten Struys eMVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top