VB.net图片框 [英] VB.net Picture Box

查看:65
本文介绍了VB.net图片框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在面板中安排了48个图片框.当我单击一个按钮时,我需要从路径"C:/temp/"加载图片.必须动态创建此48图片框的名称.但是什么也没有显示.我的代码就是这样.

I have 48 Picture box arranged in a Panel. When i click a Button i need to load pictures form path "C:/temp/". Name of this 48 picture box must be created dynamically.But nothing is displaying. my code is like this.

Dim n As Integer = 1
Dim fileType As String = "*.jpeg"
Dim fileDir As String = "C:\temp\"
Dim fileName As String
Dim PDFPicture As PictureBox
For Each fileName In System.IO.Directory.GetFiles(fileDir, fileType)
    PDFPicture = New PictureBox
    Dim pdfFile As String = "picPDF" + n.ToString
    With PDFPicture
        .Name = pdfFile
        .ImageLocation = fileName.ToString
        .Load()
        .BringToFront()
    End With
    n += 1
Next



请帮助我解决此问题.



Please help me to solve this problem.

推荐答案

设置的="_ blank" title ="New Window"> ^ ]属性
您还应该放置PictureBox的位置,或者使用 FlowLayoutPanel [^ ]

问候
Espen Harlinn
Set Parent[^] property of PDFPicture

You should also position your PictureBox''es or maybe use a FlowLayoutPanel[^]

Regards
Espen Harlinn


您从未将图片框添加到表单的Controls集合中.您还需要设置每个图片框的位置"和大小"属性,以使它们不会最终都位于完全相同的位置,并且大小完全相同.它们都具有相同的大小是可以的,只是不要将它们都置于相同的默认坐标(0,0).如果您这样做,只会看到其中一个框.
You never added the picture boxes to the Controls collection of the form. You also need to set the Location and Size properties of each picture box so they don''t all end up being in the exact same place, with the exact same size. It''s OK to have them all the same size, just don''t put them all at the same default coordinates (0,0). You''ll only see one of the boxes if you do.


这篇关于VB.net图片框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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