我认为VB 2010超载 [英] VB 2010 overload i think

查看:90
本文介绍了我认为VB 2010超载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

this is my code

Dim b As Integer = 100
Dim i As Integer
Dim u As Integer

Dim h As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    While i < 10000
        i = i + 1

        h = h + 1
        Dim pic As New PictureBox
        If i = b Then
            u = u + 1
            b = b + 100
            h = 0
        End If

        pic.BackColor = Color.Red
        pic.Size = New Size(1, 1)
        pic.Location = New Point(h, u)
        Me.Controls.Add(pic)
    End While

End Sub




它的意思是创建大量质量的picurebox,并像绘制一个简单的500x500实心框那样思考,但这将需要1000x1000图片框,因此尝试进行此工作的原因是我可以通过仅使用contains来创建一个非常容易分布的2d环境和界限.

当它可以创建500个picureboxes时,该代码可以很好地工作,但是我想我可以在不崩溃的情况下进行更多操作

这是我的错误
Error creating window handle.




its meant to create picureboxes in massive quonitys and think of it like drawing a simple 500x500 solid box but that will take like 1000x1000 pictureboxes, there reason im trying to make this work is that I can make a really easy distributable 2d environment by just using contains and bounds.

the code works very well when it can create like 500 picureboxes though, but i want to be able to make more without it crashing i think

this is my error
Error creating window handle.

can some plz help me fix this?

推荐答案

根据本文,这与要添加到表单中的控件的数量有关

错误创建窗口句柄"异常和桌面堆 [
According to this article it is to do with the number of controls that you are adding to your form

The "Error creating window handle" exception and the Desktop Heap[^]


这篇关于我认为VB 2010超载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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