Visual Studio:使用属性将视图代码设为默认 [英] Visual Studio: Make view code default using attribute

查看:142
本文介绍了Visual Studio:使用属性将视图代码设为默认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何配置VS 2008以在代码中而不是设计器中以代码形式打开Windows窗体控件.但是我想我已经看到了我可以使用可以装饰所需控件的属性来实现此目的的方法.有人知道它的名字吗?如果要在设计器中打开某些控件,并在c#代码视图中打开某些控件,这特别有用.

I know how to configure VS 2008 to open windows forms controls in code instead of the designer. But I think I have seen a way I could do this with an attribute I could decorate the desired controls with. Does anyone know its name? This is especailly usefull if you want some controls to be opened in the designer and some in the c# code view.

推荐答案

我想我已经找到您已经看到的地方: DesignerCategory 属性按顺序标记类选择打开方式:

I think I have found where you already seen that: the Brian Ensink's blog. You can use the DesignerCategory attribute to mark class in order to choose how they are opened:

  • 如果您从System.Windows.Form继承一个类,则设计器视图将打开它.
  • 如果添加[System.ComponentModel.DesignerCategory(")]属性,它将在代码视图中打开.

这篇关于Visual Studio:使用属性将视图代码设为默认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆