Introduction
If you derive a class from Component
, then Visual Studio assumes it's a UI element. Unfortunately, PrintDocument
is derived from Component
- and isn't visual at all, it just uses graphics to draw onto output contexts. But your class counts as a visual element as well despite having no UI, so VS will open it in the design view.
Which promptly brings up a blank screen and invites you to add UI elements to it. :sigh:
To Fix It Is Simple
Just add an attribute to your class definition:
[System.ComponentModel.DesignerCategory("Code")]
public class MyPrinter : PrintDocument
Now VS will put the icon back to normal, and open in the code view.
History
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?