Hi,
I'm facing a weird problem. I want to draw 15 pictureboxes in a horizontal line. I created an array of 15 boxes and in a loop, I assign it a picture and I set the location. Then I add the box to the form. -
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
Dim a, b As Integer
-
Dim picLucifer(14) As PictureBox
-
b = 1
-
For a = 0 To 14
-
picLucifer(a) = New PictureBox()
-
picLucifer(a).Image = My.Resources.middlefinger
-
picLucifer(a).Location = New Point(20, b)
-
picLucifer(a).Visible = True
-
b = b + 50
-
Me.Controls.Add(picLucifer(a))
-
Next
-
End Sub
-
Now, the problem is in the picLucifer(a).Location = New Point(20, b) row. When I assign a fixed value to the X and let the Y be a variable, everything is fine. I get a vertical list of 15 pictures. However, when I switch the X and the Y, so the X as variable and the Y fixed, it just shows me one picture. So, -
picLucifer(a).Location = New Point(20, b)
-
works, but -
picLucifer(a).Location = New Point(b, 20)
-
doesn't work. Does anyone have an idea why?
Thanks!
Steven
5 1094
Is there some "scrolling" property not set correctly on your Form object?
Are your pictures really only <=50pixels wide?
Did you set a breakpoint and verify that a unique point was being created for each picture?
Nice choice of picture by the way.
Is there some "scrolling" property not set correctly on your Form object?
Are your pictures really only <=50pixels wide?
Did you set a breakpoint and verify that a unique point was being created for each picture?
Nice choice of picture by the way.
There is no scrolling propery on the object. This is actually the only piece of code in the solution, as I am just trying and playing around. The size of the picture, which is an emoticon ( http://www.stevenvandenbrink.nl/middlefinger.gif), is only 37 x 21. I set breakpoints and the integer b does change...
Steven
@MrMancunian
So when it does change, which of your 14 PictureBoxes is actually being placed? The first instance, the last?
What about changing the calculation of your horizontal offset to include the Bounds.Left of the form its going onto? In theory the left edge should be zero, right? So it shouldn't make a difference whether you include it or not. But if the left edge has some weird geometry for some reason, and the left edge is -70, then your first several boxes will be drawn in a non-visible space.
You might also consider using different images in each box so you can tell which box is being drawn in which location. Having them all come up as .middlefinger makes it harder to tell which is which.
Must be a VB thing because mine worked fine?
Also:
New Point(20, b)
Is the setup to produce a vertical grouping (one below the previous going downward) and not horizontal
Hi,
I solved the problem. I had to set the size of the picturebox to be the same as the image I put into the box. Thanks for the help :-)
Steven
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Scott Mackay |
last post by:
Hi,
I'm using visual studio dotnet 2002 programming in vb
can anyone tell me how I can handle the mousedown event for pictureboxes I
create dynamically at runtime?
I've tried setting the...
|
by: Benoit Martin |
last post by:
I had to draw my own control because I couldn't find any control doing what
I wanted it to do. This control has a grid that I need to have control over.
To do that, I draw each line of the grid...
|
by: lgbjr |
last post by:
Hello All,
I have several Pictureboxes (linked to an AccessDB) on a VB.NET form. I
would like to use a context menu to allow the user to open the picture in
their default picture viewer or...
|
by: Rohan |
last post by:
Hi There,
Is it possible to rotate or resize pictureboxes, labels, textboxes at runtime?
And I even wanted to make textbox and label controls Transperent ?
|
by: KitKat |
last post by:
Problem trying to figure this out, using a combo box selection I need to go
to each folder, Cam 1, Cam 2, Cam 4, Cam 6, Cam 7,and Cam 8 and display each
picture (from selection) from each folder...
|
by: Pascal |
last post by:
Je veux que mes label soit transparent aussi sur mes picturebox alors
j'écris :
i want my labels to be transparent on my pictureboxes so i wrote :
Private Sub Form1_Load(ByVal sender As Object,...
|
by: Blarneystone |
last post by:
I am pulling my hair out over this one. I've got a picturebox with
just a simple gradient as the background for my interface. It is in
16bit RGB color. I've created some pictures I'll use as...
|
by: =?Utf-8?B?bGpsZXZlbmQy?= |
last post by:
I am implementing an Office 2007 – like interface, including the ability to
change colors. One issue that I have is that scrollbars look poor if the
application color theme (e.g., Black) does...
|
by: djpaul |
last post by:
Heey!
For my program i need to create pictureboxes on the fly.
After adding pictures to the database with a surten folder you can eddit the pictures or the text that's with it.
But when i select a...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |