Class derived from RichText control acts as though it should have a Design Time UI. Why?

  • Thread starter Thread starter Richard Lewis Haggard
  • Start date Start date
R

Richard Lewis Haggard

Environment: C# in VS05

I derived a class from RichText and added it to a project. There is
something about the class that is confusing VS05. In the Solution Explorer,
the icon associated with the class file is a gray rectangle with a small
white rectangle with a red cross on it in the upper left corner of the gray
icon. Double clicking on this icon doesn't open the file in code mode.
Instead, VS05 displays a gray screen with the words "To add components to
your class, drag them from the Toolbox and use the Properties window to set
thier properties. To create methods and events for your class, click here to
switch to code view."

Why is VS05 displaying this gray page? Why doesn't it go straight to the
class file?

The class definition looks something like this:

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing.Printing;

namespace blah.blah.blah
{
public class RichTextBoxEx : RichTextBox
{
// code removed for brevity...
}
}
 
I got around the problem by creating a User Control and embedding the
RichText and its extended functionlity inside of that. This seems to make
VS05 happy.
 
Back
Top