2015-07-12 117 views
-2

我刚刚开始编写一个简单的Windows窗体,但是当我编译它时,按钮/文本框不显示。Windows窗体的内容不显示

只弹出一个空白窗口。

+1

在InitializeComponent函数中显示代码。 – Pankaj

+0

@Pankaj InitializeComponent(); \t \t \t // \t \t \t // TODO:在此处添加构造函数代码 \t \t \t // – rvmod

回答

0

看起来你的InitializeComponent函数中没有任何东西。 在函数中添加此代码,您应该看到一个写有“Connect”的按钮。

private void InitializeComponent() 
{ 
    System.Windows.Forms.Button ConnectBtn = new System.Windows.Forms.Button(); 
    ConnectBtn.Location = new System.Drawing.Point(10, 10); 
    ConnectBtn.Name = "ConnectBtn"; 
    ConnectBtn.Size = new System.Drawing.Size(75, 23); 
    ConnectBtn.Text = "Connect"; 

    this.Controls.Add(ConnectBtn); 
}