C# Windows窗体在打开时显示为空
这是表单打开时的显示方式 表单应该是什么样子的 注意:当我在visual studio中没有开始制作win form应用程序时,这是一个游戏专用服务器,它是一个.sln,其中包含9个项目,所有这些项目都可以一起编译和工作,我正在试验,看看是否可以在其中制作windows form,到目前为止,我得到了很好的结果,除了当我执行命令(/wedit)打开它时,表单显示为空白,同时在VS中,我确实在表单中添加了内容 FrmWorldEdit.Designer.cs如下C# Windows窗体在打开时显示为空,c#,visual-studio-2015,C#,Visual Studio 2015,这是表单打开时的显示方式 表单应该是什么样子的 注意:当我在visual studio中没有开始制作win form应用程序时,这是一个游戏专用服务器,它是一个.sln,其中包含9个项目,所有这些项目都可以一起编译和工作,我正在试验,看看是否可以在其中制作windows form,到目前为止,我得到了很好的结果,除了当我执行命令(/wedit)打开它时,表单显示为空白,同时在VS中,我确实在表单中添加了内容 FrmWorldEdit.Designer.cs如下 namespace WorldE
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()
{
}
}
}
名称空间编辑
{
部分类FrmWorldEdit
{
///
///必需的设计器变量。
///
private System.ComponentModel.IContainer components=null;
///
///清理所有正在使用的资源。
///
///如果应释放托管资源,则为true;否则为false。
受保护的覆盖无效处置(布尔处置)
{
if(处理和(组件!=null))
{
组件。Dispose();
}
基地。处置(处置);
}
#区域Windows窗体设计器生成的代码
///
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
///
私有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();
这个.SuspendLayout();
//
//列表砖
//
this.listTiles.Anchor=((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|系统、窗口、窗体、主播样式(左)
|System.Windows.Forms.AnchorStyles.Right);
this.listTiles.Location=新系统.图纸.点(24,69);
this.listTiles.Margin=新系统.Windows.Forms.Padding(6);
this.listTiles.MultiSelect=false;
this.listTiles.Name=“listTiles”;
this.listTiles.Size=新系统.Drawing.Size(512,492);
this.listTiles.TabIndex=0;
this.listTiles.UseCompatibleStateImageBehavior=false;
this.listTiles.View=System.Windows.Forms.View.List;
this.listTiles.SelectedIndexChanged+=新的System.EventHandler(this.listTiles\u SelectedIndexChanged);
//
//lblSearch
//
this.lblSearch.AutoSize=true;
this.lblSearch.Location=新系统图点(19,28);
this.lblSearch.Name=“lblSearch”;
this.lblSearch.Size=新系统图纸尺寸(138,25);
this.lblSearch.TabIndex=1;
this.lblSearch.Text=“搜索分幅:”;
//
//TBX研究
//
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=新系统图点(163,26);
this.tbxSearch.Name=“tbxSearch”;
this.tbxSearch.Size=新系统.Drawing.Size(373,31);
this.tbxSearch.TabIndex=2;
this.tbxSearch.TextChanged+=new System.EventHandler(this.tbxSearch_TextChanged);
//
//B扭动
//
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=新系统图纸点(24617);
this.btnToggle.Name=“btnToggle”;
this.btnToggle.Size=新系统.Drawing.Size(512,45);
this.btnToggle.TabIndex=3;
this.btnToggle.Text=“开始绘制”;
this.btnToggle.UseVisualStyleBackColor=true;
this.btnToggle.Click+=新建System.EventHandler(this.btnToggle\u Click);
//
//LBL选定
//
this.lblSelected.Anchor=((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left));
this.lblSelected.AutoSize=true;
this.lblSelected.Location=新系统图点(20577);
this.lblSelected.Name=“lblSelected”;
this.lblSelected.Size=新系统图纸尺寸(197,25);
this.lblSelected.TabIndex=4;
this.lblSelected.Text=“所选磁贴:无”;
//
//FrmWorldEdit
//
this.AutoScaleDimensions=新系统.Drawing.SizeF(12F,25F);
this.AutoScaleMode=System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize=新系统.Drawing.Size(564685);
this.Controls.Add(this.lblSelected);
this.Controls.Add(this.btntogle);
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=“世界编辑器工具”;
this.FormClosing+=new System.Windows.Forms.FormClosingEventHandler(this.FrmWorldEdit\u FormClosing);
此选项为.resume布局(false);
这个。执行布局();
}
#端区
private System.Windows.Forms.ListView listTiles;
private System.Windows.Forms.Label lblSearch;
private System.Windows.Forms.textbxsearch;
private System.Windows.Forms.Button b切换;
已选择private System.Windows.Forms.Label lbl;
公共FrmWorldEdit()
{
}
}
}
您已经提供了“FrmWorldEdit.Designer.cs”文件的内容
转到“FrmWorldEdit”文件,确保构造函数中有“InitializeComponent”方法调用,如下所示:
public partial class FrmWorldEdit : Form
{
public FrmWorldEdit()
{
InitializeComponent();
}
}
不要忘记