Unable to get the designer view window back using windows forms with Visual Studio 2010

后端 未结 15 1658
逝去的感伤
逝去的感伤 2020-12-20 11:08

I am in process of writing a C# Windows Forms application using Visual Studio Express 2010 ENU SP1. Further VS specifics are at the bottom of this post. I recently made so

相关标签:
15条回答
  • 2020-12-20 11:33

    I realise this is quite an old thread now, but I just had something similar happen in one of my projects in VS2010. There was no way to edit the Form in the form designer.

    In the end tracked it down to a problem in the .csproj file. There is a item group that specifies what is compiled. Within the item group tag, for my form it had ...

    <Compile Include="AreaChart.cs" />
    

    it needed...

    <Compile Include="AreaChart.cs">
      <SubType>Form</SubType>
    </Compile>
    

    The SubType XML tag was missing. A quick change to the project file and I could edit the form again.

    0 讨论(0)
  • 2020-12-20 11:35

    I realise this is a really old thread now, but I had the same problem and it turns out there is another node that can go astray in the csproj file; the form .resx has an EmbeddedResource node and mine was missing the subnode Designer. This allowed me to see the form code again in the IDE.

    0 讨论(0)
  • 2020-12-20 11:37

    Although this is quite an old thread, I want to share my case and the solution.

    I had the same problem but I used Telerik WinForms component for my Form. I couldn't see the designer until I realize that the design-time capabilities of RadControls for WinForms are implemented in the Telerik.WinControls.UI.Design.dll assembly. Then I add the reference and now the designer shows up.

    0 讨论(0)
  • 2020-12-20 11:38

    Again it is an old thread but web interest indicates that numerous people are still having this problem and it has not been solved.

    I am using VS2012 and had the problem when I copied a library control which spawns 3 forms into a separate library for further development. All controls in the forms displayed perfectly when run but the designer displayed a blank form.

    The problem was not as above (that was intact) but, thanks to this hint, I added a new form and compared the entries in the .csproj file. For each of the copied forms, an entry akin to the following was showing:

    <Compile Include="MyForm.Designer.cs" />
    

    What was needed was:

    <Compile Include="MyForm.Designer.cs">
        <DependentUpon>MyForm.cs</DependentUpon>
    </Compile>
    

    Adding these manually for each form solved the problem.

    0 讨论(0)
  • 2020-12-20 11:39

    I had the same issue since I had created the project as a C# Windows Form App (.NET Core) I decided to create it as a C# Windows Form App (.NET Framework) and I can now see and use the Designer. Note the difference between using 'Core' vs 'Framework'

    I hope this helps you out.

    0 讨论(0)
  • 2020-12-20 11:40

    Tried all the suggestions mentioned in this question, nothing worked for Visual Studio Community 2017

    • no Shift-F7 shotcut
    • no context menu item visible
    • no double clicking on MainForm.cs
    • no wrong class order inside MainForm.cs
    • no wrong entries in mysolutionname.csproj file

    But this worked for me

    1. Right click your MainForm.cs file (or 'Form.cs' depending how you named it)
    2. 'Exlude from project'. This temporarily removes MainForm.cs, MainForm.Designer.cs and MainForm.resx
    3. Use 'Add » Existing item' and select MainForm.cs. This will re-include all three files.
      Of course you should add them back to the same folder as they were before
    4. Double click on MainForm.cs and Design view magically openes
    0 讨论(0)
提交回复
热议问题