在运行时操作UI [英] Manipulating UI at runtime

查看:77
本文介绍了在运行时操作UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在运行时创建一个嵌套的组框UI以及10个按钮.有人可以指导我如何去做吗?谢谢.

I need to create a nested group box UI as well as 10 buttons, all at runtime. Could someone guide me into how I can go about doing this? Thanks.

推荐答案

最简单的学习方法是通过设计器,然后查看设计器生成的代码.该代码几乎是您在运行时编写此代码所需要的.
Easiest way to learn how to do this is to do it via the designer, and then look at the designer generated code. That code is pretty much what you need to write to do this at run-time.


下面的示例用于将单个按钮放入面板.

The example below is for putting a single button into a panel.

btn = new button
btn.name = unqiueButtonName
btn.left = 10
btn.top = 20
btn.Text = "Button Name"

'This is the important part as this is how you add
'the events for button
addHandler btn.click, addressof BtnEvent
panelName.controls.add(btn)





Public sub BtnEvent()
  'Do event handling stuff here
End Sub


这篇关于在运行时操作UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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