如何在运行时在vb.net中为动态创建的按钮调整大小(更改大小)? [英] How to resize(change size) for dynamically created button in runtime in vb.net ?

查看:98
本文介绍了如何在运行时在vb.net中为动态创建的按钮调整大小(更改大小)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai

i我动态创建按钮

Hai
i am create buttons dynamically like

Dim btn As New Button
btn.Text="ONE"
btn.Name="ONE"
btn.FlatStyle = FlatStyle.Flat
btn.BackColor = Color.Transparent
btn.Font = New Font("Segoe UI", 9.0)
btn.Font = New Font(btn.Font, FontStyle.Bold)
btn.FlatAppearance.MouseOverBackColor = Color.Transparent
btn.FlatAppearance.MouseDownBackColor = Color.Transparent
btn.Width = 60  'By default width is 60
btn.Height = 40  'By default height is 40


上面的
我将给出默认按钮的高度和宽度,所以只能在表单中看到,创建按钮后需要调整按钮的大小,我的意思是我们在视觉工作室设计时间(点击按钮边框并拖动调整大小)实际上







请尽快回复...





问候

Aravind


in above i will give default button height and width so only can see in form,after created buttons need to resize the button,i mean actually we do in visual studio design time(click button border and drag for resize)



Pls reply asap...


Regards
Aravind

推荐答案

btn.Size = new Size(width, height)






or

btn.Width = width
btn.Height = height





我在这里假设Windows窗体,但你可能想要阅读Button类的文档,此处 [ ^ ]。


运行时控制调整器 [ ^ ]



您要求的是运行时调整大小,而不是更改动态创建的控件,因为上面的内容适用于动态创建的控件和静态创建的控件。
Runtime Control Resizer[^]

What you are asking for is Runtime resizing, not changing dynamically created controls since the above will work for both dynamically created controls and statically made ones.


这篇关于如何在运行时在vb.net中为动态创建的按钮调整大小(更改大小)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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