如何阻止Visual Studio在设计器中打开Winforms控件 [英] How to stop visual studio from opening my winforms controls in the designer

查看:107
本文介绍了如何阻止Visual Studio在设计器中打开Winforms控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我要编辑/查看我创建的winforms控件/窗体的代码时,我需要右键单击解决方案并选择查看代码。打开文件的默认操作是视图设计器。对于任何包含从Winforms控件继承的类的C#文件,即使是间接的,这似乎都是这种情况。

When I want to edit/view the code for a winforms control/form i created, I need to right-click in the solution and select "view code". The default action for opening the file is "view designer". This appears to be the case for any C# file containing a class that inherits from a winforms control, even if this is indirectly.

愚蠢的事情是,如果VS无法运行设计器(例如,控件不是文件中的第一类),则VS会这样做。

The daft thing is that VS does this if it can't run the designer (for instance when the control is not the first class in the file).

是否存在阻止VS执行此操作的提示或属性或解决方法?

Is there hint or attribute or workaround to stop VS from doing this?

推荐答案


  • 右键单击解决方案中的文件

  • 选择打开方式...

  • 选择 CSharp编辑器

  • 单击设置为默认值。

    (在Web应用程序中,您需要选择 Web表单编辑器)

    • Right-click on a file in your solution
    • Select "Open With..."
    • Select "CSharp Editor"
    • Click "Set as Default".
      (In a web application, you need to select "Web Form Editor")
    • 这篇关于如何阻止Visual Studio在设计器中打开Winforms控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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