?
Solved

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

Posted on 1998-08-07
10
Medium Priority
?
187 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 150 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

801 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