Re: Prevent UserControl derivative from being designed



Doing it with source is pointless 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

  • Re: Prevent UserControl derivative from being designed
    ... You can do a runtime check to see if a control is in design mode by looking ... Find great Windows Forms articles in Windows Forms Tips and Tricks ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: list (CSAA) of must see animals.
    ... anything from Dan McGrath only if someone else thinks it worth ... perhaps, hundreds of times, the ploy no longer works". ... Only if you actually believe that Dan can't alter his behavior. ... If you believe he can alter [i.e. control] his behavior, ...
    (alt.usage.english)
  • Re: reducing the cost of labor
    ... These are only some of the latest articles identified in a very ... Unka' George [George McDuffee] ... for Time is the greatest innovator: ... and wisdom and counsel shall not alter them to the better, ...
    (rec.crafts.metalworking)
  • Re: NIP arrived.
    ... >> That, however, doesn't alter the fact that the root cause of any such ... >> accidents, though, is poor driving - failure to take that design into ... not the driver. ... > result in more accidents than a well designed road. ...
    (uk.rec.driving)
  • Re: Option Buttons and colors
    ... I thought there was a way to alter the color of the circle itself, ... Backcolor only addresses the area surrounding the click area, ... where the text for the control is, as far as i can tell. ...
    (microsoft.public.excel.programming)