【问题标题】:Windows Form Application C sharp visual studio 2010Windows 窗体应用程序 CSharp Visual Studio 2010
【发布时间】:2010-11-28 21:51:12
【问题描述】:

我正在制作一个 UNO 游戏应用程序。我方便地创建了一个 form2(游戏桌),显示所有玩家及其卡片等。现在,我只想添加一个文本框来显示当前玩家。

所以我做的是 -

  1. 拖放了一个文本框。 警告 - 警告 1 您必须重新构建项目才能使 Gui1.Form2 的更改显示在任何打开的设计器中。 0 0

  2. 重建表格 -

我看到正在创建另一个文件 - form21.designer.cs。 PL。查看下面文件的内容 -

错误 - 错误 1 ​​在声明类型“Gui1.Form2”时缺少部分修饰符;此类型的另一个部分声明存在 C:\Users\uday\Desktop\Uday\Client_0407\Gui1\Form21.Designer.cs 25 18 Gui1

注意 - 它不仅仅是文本框。如果我进行任何拖放修改,也会发生同样的情况。

form21.designer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Gui1 {
    using System;


    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class Form2 {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Form2() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gui1.Form2", typeof(Form2).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        public static System.Drawing.Bitmap Pic_MyPlayer_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_MyPlayer.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        public static System.Drawing.Bitmap Pic_OtherPlayer1_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_OtherPlayer1.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        public static System.Drawing.Bitmap Pic_OtherPlayer2_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_OtherPlayer2.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        public static System.Drawing.Bitmap Pic_OtherPlayer3_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_OtherPlayer3.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
    }
}

【问题讨论】:

  • 哇,太棒了。快,在它爆炸之前把它关掉!

标签: c# winforms


【解决方案1】:

你的文件乱了;似乎试图将资源类的一半转换为表单。

通过右键单击项目并单击“添加”、“Windows 窗体”来添加新窗体(并为其命名,不是Form2)并将您的代码移入其中。
然后,删除当前功能失调的 Form2 中涉及的所有文件。

【讨论】:

    猜你喜欢
    • 2023-03-19
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-08
    • 2014-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多