|
-
Oct 30th, 2002, 05:42 PM
#1
Thread Starter
Fanatic Member
Create Control at Runtime
Please ignore my other post, here is a new one:
What I need to do is:
I have a form, when I click anywhere on the form, I need a Image CREATED. Where? I need it CREATED on the closest pre-defined Top and Left. (Ex. I have 2 Tops: 1 and 5 and 2 Lefts: 1 and 5. If I click Top:2 and Left:3, I need my Image created on Top1, Left 5)
Now each time I click on the form, my app will create a new image, I need these images placed in an array (First time I click my Image will be Img(0), the second time I click my image will be Img(1), etc.)
Is this possible? If yes, can someone please help me?
There is a certain pattern to the pre-defined Tops and Lefts:
Top: 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 1320, 1320, 1320, 1320, etc.
Left: 360, 1320, 2280, 3240, 4200, 5160, 6120, 7080, 8040, 9000, 360, 1320, 2280, 3240, etc.
"A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
"First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
- Robert Matthews, Science Correspondent
-
Oct 30th, 2002, 07:34 PM
#2
Frenzied Member
OK:
VB Code:
'Decleration:
Dim ImgNo as Integer
' Form Load:
ImgNo = 0
' You Need At Least one control ALREADY IN YOUR PROJECT!!!
' Just make it visible, etc.
' Next One:
Dim PreTop as Integer, PreLeft as Integer
PreTop= ??
PreLeft= ??
ImgNo = ImgNo + 1
Load img(ImgNo)
Img(ImgNo).Top = PreTop
Img(ImgNo).Left = PreLeft
'ETC..
' Make sure you unload all your Images made:
If Img.Count > 1 Then
Dim I as Integer
For I=1 To Img.Count
Unload Img(I)
Next I
End If
Dat should fix it for you?
You need to make the left & Top still though, just fill in the ??
: Hope it helps :P
-
Oct 30th, 2002, 07:45 PM
#3
Thread Starter
Fanatic Member
Originally posted by wpearsall
OK:
VB Code:
'Decleration:
Dim ImgNo as Integer
' Form Load:
ImgNo = 0
' You Need At Least one control ALREADY IN YOUR PROJECT!!!
' Just make it visible, etc.
' Next One:
Dim PreTop as Integer, PreLeft as Integer
PreTop= ??
PreLeft= ??
ImgNo = ImgNo + 1
Load img(ImgNo)
Img(ImgNo).Top = PreTop
Img(ImgNo).Left = PreLeft
'ETC..
' Make sure you unload all your Images made:
If Img.Count > 1 Then
Dim I as Integer
For I=1 To Img.Count
Unload Img(I)
Next I
End If
Dat should fix it for you?
You need to make the left & Top still though, just fill in the ??
: Hope it helps :P
yes this helps, thx. 2 things:
1. Why do I have to unload my image????
2. My PreTop and PreLeft have to be the closest Top and Left to where i clicked
"A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
"First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
- Robert Matthews, Science Correspondent
-
Oct 30th, 2002, 08:27 PM
#4
Thread Starter
Fanatic Member
"A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
"First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
- Robert Matthews, Science Correspondent
-
Oct 30th, 2002, 09:35 PM
#5
Frenzied Member
Unload the images, on form unload,
to reduce memory usage (And it will make sure it frees the usage if the app doesn't unload em with "Unload Me"
PreTop =
and
PreLeft =
This is mainly the bit u need to do,
I dont know how ur getting ur Two No's, so cant help u there?
When u get your two numbers, it should be able to get it then?
-
Oct 30th, 2002, 09:41 PM
#6
Thread Starter
Fanatic Member
I got it all working THX a lot!!
"A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
"First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
- Robert Matthews, Science Correspondent
-
Oct 30th, 2002, 09:45 PM
#7
Frenzied Member
YW, No Problem 
Might be interested in this too:
VB Code:
img(i).ZOrder(0) ' Bring the control Forward
img(i).ZOrder(1) ' Send the control Back
Incase u wanna order the forms etc,
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
|