Visual inheritance and DESIGN constant: Where is it?

G

Guest

Hello all

I have developed a class that inherits from System.Windows.Forms.From and I
intend to use it as the base type for all of my projects Forms.

I am aware thet Visual Studio does not support visual inheritance for .NET
CF forms so I tried to fool the designer by using the DESIGN constant:

#if DESGING
public class MyForm: System.Windows.Forms.Form
#else
public class MyForm: MyCompany.MyNamespace.EnhancedForm
#endif
{
...

I've seen this trick used in OpenNETCF libraries and I've read articles
about it on the web. VS 2003 is supposed to define the DESIGN constant
automatically while in the desginer. However, everything I place inside the
#if DESIGN block is always grayed out, unless I define the constant myself.

Does the DESIGN constant really exist?

Thanks in advance!
 
P

Peter Foot [MVP]

The DESIGN constant is not automatically defined. You should add an
additional configuration to your project (by default you'll have Debug and
Release) and when this configuration open the "[Project Name] Properties"
and you will be able to add to the default Conditional Compilation Constants
for the project. Then you can switch between the Design configuration you
created and Debug and Release depending on whether you are using the forms
designer or debugging the code. It's also a good idea to close any open
forms in the designer before switching configurations and don't open them
while not in your Design configuration.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
G

Guest

Thank you Peter.

I was mislead by a post to this newsgroup:

http://groups.google.com/groups?hl=...&selm=eBin9xxRDHA.2316%40tk2msftngp13.phx.gbl

Your suggestion works just fine!

Peter Foot said:
The DESIGN constant is not automatically defined. You should add an
additional configuration to your project (by default you'll have Debug and
Release) and when this configuration open the "[Project Name] Properties"
and you will be able to add to the default Conditional Compilation Constants
for the project. Then you can switch between the Design configuration you
created and Debug and Release depending on whether you are using the forms
designer or debugging the code. It's also a good idea to close any open
forms in the designer before switching configurations and don't open them
while not in your Design configuration.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups

Strider said:
Hello all

I have developed a class that inherits from System.Windows.Forms.From and
I
intend to use it as the base type for all of my projects Forms.

I am aware thet Visual Studio does not support visual inheritance for .NET
CF forms so I tried to fool the designer by using the DESIGN constant:

#if DESGING
public class MyForm: System.Windows.Forms.Form
#else
public class MyForm: MyCompany.MyNamespace.EnhancedForm
#endif
{
...

I've seen this trick used in OpenNETCF libraries and I've read articles
about it on the web. VS 2003 is supposed to define the DESIGN constant
automatically while in the desginer. However, everything I place inside
the
#if DESIGN block is always grayed out, unless I define the constant
myself.

Does the DESIGN constant really exist?

Thanks in advance!
 

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