动态创建按钮并将其放置在表单内的特定位置 [英] create button dynamically and place in specific position inside the form

查看:105
本文介绍了动态创建按钮并将其放置在表单内的特定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

动态创建按钮,并将其放置在表单内的特定位置.

create button dynamically and place in specific position inside the form. when the form load already created button also should retrieve and visible .

推荐答案

button btn = new Button();
btn.Location = new System.Drawing.Point(this.width-10, this.height-10);
this.controls.add(btn);
btn.BringToFront();


祝您编码愉快!
:)


Happy Coding!
:)


创建按钮
Button btnOlder = new Button();


设置按钮的位置.


Set the position of the Button.

btnOlder.Location = new System.Drawing.Point(X-Axis, Y-Axis);


尝试一下...

Try this...

Button btn = new Button();
btn.Name = "btn_1";
btn.Top = 50;//specify the top position
btn.Left = 50;
btn.Width = 200;
btn.Height = 200;
//btn.Location = new System.Drawing.Point(50, 50); //alternative solution
btn.Text = "Button Created Dynamically"
this.Controls.Add(btn);
btn.BringToFront();



希望这会有所帮助.
欢呼



Hope this helps.
cheers


这篇关于动态创建按钮并将其放置在表单内的特定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆