private void button3_Click(object sender, EventArgs e)
{
Button bt = new Button();
bt.DialogResult = DialogResult.OK;
bt.Visible = true;
bt.Height = 52;
bt.Width = 52;
}
应该来说我点按钮,就可以多出一个出来,但事实上,根本就不行,大家帮忙看一下怎么回事.
{
Button bt = new Button();
bt.DialogResult = DialogResult.OK;
bt.Visible = true;
bt.Height = 52;
bt.Width = 52;
}
应该来说我点按钮,就可以多出一个出来,但事实上,根本就不行,大家帮忙看一下怎么回事.
private void button3_Click(object sender, EventArgs e)
{
Button bt = new Button();
bt.DialogResult = DialogResult.OK;
bt.Visible = true;
bt.Height = 52;
bt.Width = 52;
this.Controls.Add(bt);
}
具体忘了。你 = 的时候会有枚举提示的
打开代码如下
Ainventory ait = new Ainventory(sql);
ait.ShowInTaskbar = false;//不显示窗体
ait.ShowDialog();
重载的代码如下
public Ainventory(string sql2)
{
InitializeComponent();
dsql2 = sql2;
//建立一个按钮返回确定
Button bt = new Button();
bt.DialogResult = DialogResult.OK;
bt.Visible = true;
bt.Height = 50;
bt.Width = 50;
bt.Left = 900;
bt.Top = 500;
bt.Text = "确定";
this.Controls.Add(bt);
}
结果没有发现出来有button, 不知道是不是因为Ainventorye 有其它控件,把它给遮住了,如果我想提到最长层该如何弄呢
this.btAnchor = AnchorStyles.Bottom | AnchorStyles.Right;
this.bt.Location = new System.Drawing.Point(this.Width-bt.Width, this.Height-bt.Height);//绑定边缘
this.bt.btAnchor = AnchorStyles.Bottom | AnchorStyles.Right;刚才少打了一句
这句才对的
{
Button bt = new Button();
bt.DialogResult = DialogResult.OK;
bt.Visible = true;
bt.Height = 52;
bt.Width = 52;
this.Controls.Add(bt);
}
能出来了 其他属性自己定义。ok
你的子窗体已经被其他控件遮盖住了。你找到这个控件,首先它必须是个容器,比如GroupBox1,
this.groupBox1.Controls.Add(this.button1);
private void button3_Click(object sender, EventArgs e)
{
Button bt = new Button();
bt.DialogResult = DialogResult.OK;
bt.Visible = true;
bt.Height = 52;
bt.Width = 52;
this.Controls.Add(bt);
}