Solved

How to create a new image on Picturebox in a MDIForm ?

Posted on 1998-08-07
10
185 Views
Last Modified: 2012-05-04
I call this Sub several times to add new pictures:

Public Sub LäggTillBild(Fil$)
Static XW%, YH%, X%, NyBild() As Image
On Error GoTo LäggTillBild
    ReDim Preserve NyBild(X%)
    Set NyBild(X%) = Image1(0)
    NyBild(X%) = LoadPicture(Fil$)
    If XW + NyBild(X%).Width + 100 > Screen.Width Then _
      YH = YH + NyBild(X%).Height: XW = 0
    NyBild(X%).Left = XW
    NyBild(X%).Top = YH
    NyBild(X%).Visible = True
    XW = XW + NyBild(X%).Width
    NyBild(X%).Tag = Fil$
    X% = X% + 1
    Exit Sub
LäggTillBild:
    MsgBox Error, 16
    Set NyBild(X%) = Nothing
    Exit Sub
End Sub

Why can i just see the last thumbernail loaded ?
How to get scrollbars to the MDIform when i rezize it ?

/Janne, SWEDEN
0
Comment
Question by:jannea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 

Expert Comment

by:Nusse
ID: 1468278
Tjenare Janne

Hur visar du bilderna? I rad, eller? Har du en egen KÖPT version?



0
 
LVL 1

Author Comment

by:jannea
ID: 1468279
Hej du Nusse !

Som det framgår i koden så fylls en rad och sedan kommer nästa rad med bilder under den första.

Köpt version ? av VB5  eller ja det har jag...
Problemet mitt är att jag inte kan skapa en ny Image för varje gång utan jag gissar att det är samma Image som flyttar på sig. Det är väl därför jag bara ser den sista.

Vet du hur man i kod skapar en ny Image ?

/Janne
0
 
LVL 14

Expert Comment

by:waty
ID: 1468280
Is this in english or other language discussion group?


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:jannea
ID: 1468281
Waty, It was Swedish, you are welcome with English....
0
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
ID: 1468282
You always use the same Image1(0) control. Use the new operator to add new images.

NB : Why do you store images in the array? It should be easier to add it directly to controls?

0
 
LVL 1

Author Comment

by:jannea
ID: 1468283
Waty,

How to use the new operator to add new images. ? ,code PLS I can´t Dim NyBild As New Image.

OK I don´t need the array, this was just when I did test some other stuff.
0
 
LVL 14

Expert Comment

by:waty
ID: 1468284
You have to do as following :

Public Sub LäggTillBild(Fil$)

Static XW%, YH%, X% as long

On Error GoTo LäggTillBild

    load Image1(X%)
    Image1(X%) = LoadPicture(Fil$)
    If XW + Image1(X%).Width + 100 > Screen.Width Then _
      YH = YH + NyBild(X%).Height: XW = 0
    Image1(X%).Left = XW
    Image1(X%).Top = YH
    Image1(X%).Visible = True
    XW = XW + Image1(X%).Width
    Image1(X%).Tag = Fil$
    X% = X% + 1

    Exit Sub
LäggTillBild:
    MsgBox Error, 16
    unload Image1(X%)
    Exit Sub

End Sub
0
 
LVL 1

Author Comment

by:jannea
ID: 1468285
Waty, thanks

So now if works better, I know I seen the tecniqe Load 'Image()' before to add new controls.
How aboute the the Q:

How to get scrollbars to the MDIform when i rezize it ?  (See above)

/Janne
0
 
LVL 14

Expert Comment

by:waty
ID: 1468286
To have scrollbar on your MDI, your childs must be out of the current view (part of form or completely).
0
 
LVL 1

Author Comment

by:jannea
ID: 1468287
Ok
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question