|
-
Mar 21st, 2003, 03:09 AM
#1
Thread Starter
Hyperactive Member
Working with images
I'm not sure how to say this, so bare with me...
I would to know how to use the same image over and over.
By this I mean use the same image mutiple times kind of like the old sim city game, where you could click on a building and place it some where in the city and then click the building again and get another building to place in the city.
i.e I click a button and I get a new image that I can move.
I know how to move images around on a form, so that's not the problem. what I need to know is how to get "image1, ...2, ...3, ...4, etc. out of image(0) or image(i)
[VBCODE]
Option Explicit
Dim XXX As Porn
Dim Wife As Nag
Private Sub *****_Resize()
On Error Resume Next
Get Viagra
End Sub
[/VBCODE]
-
Mar 21st, 2003, 03:23 AM
#2
Frenzied Member
Use a PictureBox Array and keep loading a new instance of teh control.
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 21st, 2003, 03:40 AM
#3
Frenzied Member
Something like this..maybe
VB Code:
Dim blnFlag As Boolean
Private Sub Form_Load()
Picture1(0).Picture = LoadPicture("C:\windows\circles.bmp")
Picture1(0).AutoSize = True
Picture1(0).ScaleMode = Me.ScaleMode
End Sub
Private Sub Picture1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Load Picture1(Picture1.UBound + 1)
Picture1(Picture1.UBound).Visible = True
blnFlag = True
End Sub
Private Sub Picture1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnFlag Then
Picture1(Picture1.UBound).Move X, Y
End If
End Sub
Private Sub Picture1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnFlag Then
Picture1(Picture1.UBound).Left = X
Picture1(Picture1.UBound).Top = Y
blnFlag = False
End If
End Sub
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 21st, 2003, 04:11 AM
#4
Thread Starter
Hyperactive Member
it says the the UBound data member isn't found...
[VBCODE]
Option Explicit
Dim XXX As Porn
Dim Wife As Nag
Private Sub *****_Resize()
On Error Resume Next
Get Viagra
End Sub
[/VBCODE]
-
Mar 21st, 2003, 04:17 AM
#5
Frenzied Member
In teh properties of teh PictureBox, set its index to "0" (zero). That will convert the PictuerBox into an array of PictureBoxes with the same name.
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 25th, 2003, 09:28 PM
#6
Thread Starter
Hyperactive Member
maybe I should have said that I want to produce new images like the way VB controls are produced.
Click the button of the tool you want and draw the image size on the form and the image appears. except I want to do this during runtime and without a control.
Or better yet can the code you provided be adapted so that when I click on a Command button the image appears in a specific location so that I can move it later?
or even can it be made so that the image a named as image1, image2, image3, etc, or something like that?
I need to use the name in a label for instructions
i.e. when the user clicks on the image the label reads
move (item name).
I know how to do these things:
1.) move thing
2.) display the text in a label
3.) various other things
I don't know how to:
1.) make new images, buttons, shapes, etc. on the fly
[VBCODE]
Option Explicit
Dim XXX As Porn
Dim Wife As Nag
Private Sub *****_Resize()
On Error Resume Next
Get Viagra
End Sub
[/VBCODE]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|