打开时,Windows窗体显示为空白

时间:2015-10-28 20:44:27

标签: c# visual-studio-2015

这是表单打开时的显示方式 http://imgur.com/JbE5I6m 形式应该是什么样的 http://imgur.com/eTTiWUw

注意:当在visual studio中我没有开始制作一个win form应用程序时,这是一个用于游戏的私人服务器,它是一个包含9个项目的.sln,它们都可以编译和协同工作,我正在尝试和看看它是否可以在其中形成窗体,到目前为止我已经取得了良好的效果,除了当我执行命令(/ wedit)打开它时,表单显示为空白,同时在VS中我确实添加了表单中的内容。

下面的FrmWorldEdit.Designer.cs

namespace WorldEdit
{
    partial class FrmWorldEdit
{
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        this.listTiles = new System.Windows.Forms.ListView();
        this.lblSearch = new System.Windows.Forms.Label();
        this.tbxSearch = new System.Windows.Forms.TextBox();
        this.btnToggle = new System.Windows.Forms.Button();
        this.lblSelected = new System.Windows.Forms.Label();
        this.SuspendLayout();
        // 
        // listTiles
        // 
        this.listTiles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
        | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.listTiles.Location = new System.Drawing.Point(24, 69);
        this.listTiles.Margin = new System.Windows.Forms.Padding(6);
        this.listTiles.MultiSelect = false;
        this.listTiles.Name = "listTiles";
        this.listTiles.Size = new System.Drawing.Size(512, 492);
        this.listTiles.TabIndex = 0;
        this.listTiles.UseCompatibleStateImageBehavior = false;
        this.listTiles.View = System.Windows.Forms.View.List;
        this.listTiles.SelectedIndexChanged += new System.EventHandler(this.listTiles_SelectedIndexChanged);
        // 
        // lblSearch
        // 
        this.lblSearch.AutoSize = true;
        this.lblSearch.Location = new System.Drawing.Point(19, 28);
        this.lblSearch.Name = "lblSearch";
        this.lblSearch.Size = new System.Drawing.Size(138, 25);
        this.lblSearch.TabIndex = 1;
        this.lblSearch.Text = "Search Tiles:";
        // 
        // tbxSearch
        // 
        this.tbxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.tbxSearch.Location = new System.Drawing.Point(163, 26);
        this.tbxSearch.Name = "tbxSearch";
        this.tbxSearch.Size = new System.Drawing.Size(373, 31);
        this.tbxSearch.TabIndex = 2;
        this.tbxSearch.TextChanged += new System.EventHandler(this.tbxSearch_TextChanged);
        // 
        // btnToggle
        // 
        this.btnToggle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.btnToggle.Location = new System.Drawing.Point(24, 617);
        this.btnToggle.Name = "btnToggle";
        this.btnToggle.Size = new System.Drawing.Size(512, 45);
        this.btnToggle.TabIndex = 3;
        this.btnToggle.Text = "Start Painting";
        this.btnToggle.UseVisualStyleBackColor = true;
        this.btnToggle.Click += new System.EventHandler(this.btnToggle_Click);
        // 
        // lblSelected
        // 
        this.lblSelected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
        this.lblSelected.AutoSize = true;
        this.lblSelected.Location = new System.Drawing.Point(20, 577);
        this.lblSelected.Name = "lblSelected";
        this.lblSelected.Size = new System.Drawing.Size(197, 25);
        this.lblSelected.TabIndex = 4;
        this.lblSelected.Text = "Selected Tile: none";
        // 
        // FrmWorldEdit
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(564, 685);
        this.Controls.Add(this.lblSelected);
        this.Controls.Add(this.btnToggle);
        this.Controls.Add(this.tbxSearch);
        this.Controls.Add(this.lblSearch);
        this.Controls.Add(this.listTiles);
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
        this.Margin = new System.Windows.Forms.Padding(6);
        this.Name = "FrmWorldEdit";
        this.Text = "World Editor Tool";
        this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmWorldEdit_FormClosing);
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.ListView listTiles;
    private System.Windows.Forms.Label lblSearch;
    private System.Windows.Forms.TextBox tbxSearch;
    private System.Windows.Forms.Button btnToggle;
    private System.Windows.Forms.Label lblSelected;

    public FrmWorldEdit()
    {
    }
}
}

1 个答案:

答案 0 :(得分:3)

您提供了'FrmWorldEdit.Designer.cs'文件的内容

转到'FrmWorldEdit'文件并确保在构造函数中有'InitializeComponent'方法调用,如下所示:

    public partial class FrmWorldEdit : Form
{
    public FrmWorldEdit()
    {
        InitializeComponent();
    }
}

如果决定按照我的建议实施,请不要忘记从“Designer”文件中删除构造函数。否则保持原样,但不要忘记将'InitializeComponent()'方法添加到'Designer.cs'文件中的构造函数