VS 2010 setting non-GUI class file as Component

前端 未结 2 1758
孤独总比滥情好
孤独总比滥情好 2021-02-12 01:20

I have an annoyance that has been occurring for quite some time with Visual Studio 2010. I have a class file that I have made which VS saves as type \"Component\" for no reason

相关标签:
2条回答
  • 2021-02-12 02:11

    At a guess, I'd say it's due to your GPSPort class, which extends SerialPort, which extends Component. Try removing that (or moving it into a separate file) and see if it fixes the problem.

    0 讨论(0)
  • 2021-02-12 02:22

    If you want to keep all the classes in one file, you can use the [System.ComponentModel.DesignerCategory("Code")] attribute on the GPSPort class to override the default behavior. Details here, note that you must use the fully qualified attribute even if you have a using System.ComponentModel statement or VS will ignore it.

    0 讨论(0)
提交回复
热议问题