Re: Prevent UserControl derivative from being designed



To clarify, There are no attributes of that nature.

You can do a runtime check to see if a control is in design mode by looking
at the DesignMode property anywhere except in the constructor but that's
about it.

You can prevent a component from showing up in the toolbox by setting the
ToolboxItem attribute to False but that's not really the same either.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Tony Maresca" <tony@xxxxxxxxxxxxx> wrote in message
news:%23un3PkDpFHA.1148@xxxxxxxxxxxxxxxxxxxxxxx
>> Doing it with source is pointless
>
> I wasn't asking for opinions on whether it is a
> good idea, or not, to prevent a class from being
> designed with attributes.
>
> I was interested in learning if there are any
> attributes that can be used to prevent a class
> from being designed.
>
> In any case, thanks for your opinion.
>
> --
> Tony M.
> "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:ekFryQ9oFHA.3256@xxxxxxxxxxxxxxxxxxxxxxx
> because an enterprising programmer will
>> just alter the source to suit his needs.
>>
>> If you distribute as a DLL then the problem goes away because you can't
>> alter the class once it's compiled.
>>
>> --
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Ramuseco Limited .NET consulting
>> http://www.ramuseco.com
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tipstricks.htm
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/faqmain.htm
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>>
>>
>> "Tony Maresca" <tony@xxxxxxxxxxxxx> wrote in message
>> news:Oa1PMG7oFHA.3300@xxxxxxxxxxxxxxxxxxxxxxx
>>> Hi. I have a class derived from a UserControl,
>>> that I want to allow others to derive controls
>>> from. I don't want them to design the base
>>> class (which is derived from a UserControl).
>>>
>>> I know that I can prevent the control from being
>>> designed by making it not the first class in the
>>> code file, but is there another more 'official' way
>>> to do this via attributes.
>>>
>>> The user should be able to add the control's source
>>> to a project (or reference it in another assembly),
>>> and then select the control in the Inheritance Picker,
>>> to create a derived class, but I want to prevent the
>>> user from designing the base class.
>>>
>>> --
>>> Tony M.
>>
>>


.



Relevant Pages

  • English eBooks Engineering
    ... Adaptive Voltage Control in Power Systems Fusco, ... Advanced Design Techniques for RF Power Amplifiers Krizhanovski, ... Advanced Fuzzy Logic Technologies in Industrial Applications Bai, ... Bioinformatics Using Computational Intelligence Paradigms Jain, ...
    (sci.med.nutrition)
  • Re: Microchip programmer Sydney Aus
    ... schematic design, embedded firmware and pcb layout to finished product. ... possible through the use of advanced microcontroller products from Microchip ... microcontroller applications in Innovative Power and Control solutions. ... Resources cover a broad range of electronics ...
    (sci.electronics.design)
  • Ebooks Forum
    ... Analysis and Design of Advanced Multiservice Networks Supporting ... Control and Observer Design for Nonlinear Finite and Infinite ... IUTAM Symposium on Computational Approaches to Multiphase Flow ... Islamic Philosophy and Occidental Phenomenology on the Perennial Issue ...
    (sci.med.nutrition)
  • Re: Prevent UserControl derivative from being designed
    ... just alter the source to suit his needs. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... I don't want them to design the base ... > and then select the control in the Inheritance Picker, ...
    (microsoft.public.dotnet.languages.csharp)
  • a forum for you
    ... Advances in High Performance Computing and Computational Sciences ... Analysis and Design of Advanced Multiservice Networks Supporting ... Control and Observer Design for Nonlinear Finite and Infinite ... IUTAM Symposium on Computational Approaches to Multiphase Flow ...
    (sci.med.nutrition)