如何在运行时在图片框中创建对象? [英] how can i create objects at runtime in a picturebox?

查看:143
本文介绍了如何在运行时在图片框中创建对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的表单加载到图片框内时创建一个行数组,而不必在表单上复制粘贴。到目前为止,我已经在表单上创建了一行并将其索引设置为0.然后,在代码中我放了


对于LinCount = 1 To(somenumber)

加载BoxlinBorder(LinCount)

下一个LinCount


创建没有任何错误的行。我仍然需要以某种方式将行放入图片框中,我想在代码中声明所有内容,而不是在表单上。也就是说,有没有办法创建行数组而不必先在表单上创建一行?感谢任何帮助。


谢谢,

vfiroiu

I want to create an array of lines when my form loads inside of a picture box, without having to copy-paste on the form. so far, i have created a line on the form and set its index to 0. then, in the code i put

For LinCount = 1 To (somenumber)
Load BoxlinBorder(LinCount)
Next LinCount

which creates the lines without any errors. I still need to put the lines into a picturebox somehow, and i would like to declare everything in code, not on the form. That is, is there some way to create the line array without having to make a line on the form first? Any help is appreciated.

Thanks,
vfiroiu

推荐答案

展开 | 选择 | Wrap | 行号


是,上面的代码是Form - Activate。顺便说一句,BoxlinBorder()是一个只有一个元素的行数组(BoxlinBorder(0),我在表单中创建),我不认为我说得那么清楚。
Yes, the above code is in Form - Activate. By the way, BoxlinBorder() is a line array with only one element (BoxlinBorder(0), which i created in the form), I don''t think i made that clear.



是的,上面的代码是Form - Activate。顺便说一句,BoxlinBorder()是一个只有一个元素的行数组(BoxlinBorder(0),我在表单中创建),我不觉得我说得那么清楚。
Yes, the above code is in Form - Activate. By the way, BoxlinBorder() is a line array with only one element (BoxlinBorder(0), which i created in the form), I don''t think i made that clear.



你有没有取得任何进展?


我看到了问题。我自己在运行时加载了这样的控件数组,但总是通过创建第0来完成。设计时的元素,只需在运行时加载更多的实例。是否真的需要避免这种情况,或者仅仅是因为你决心击败这件事? :-)


无论如何,我会玩游戏,看看能否想出任何东西。

Have you made any progress on this?

I see the problem. I''ve loaded arrays of controls like this at runtime myself, but have always done so by creating the "zeroth" element at design time and simply loading more occurrences at runtime. Is there a real need to avoid this, or is it just that you''re determined to "beat this thing"? :-)

Anyway, I''ll have a play around and see whether I can come up with anything.


这篇关于如何在运行时在图片框中创建对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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