|
-
Apr 29th, 2001, 04:13 PM
#1
Thread Starter
Hyperactive Member
Whoa
Hello, and welcome
Today I want to ask on about my dragon-problem. Not the same ol' stupid question, I've figured that out. But my new topic is still related to the issue of object-oriented programming.
If you haven't read my previous thread:
I have a dragon which I call 'Drag'. It's a class module called Drage and a 'Drag' which is a 'Drage'
Option Excplict
Public Drag as New Drage
But this control, Drage, needs a picture to display itself on the screen. I've used the coding:
Dim Monster1 As Image
Set Monster1 = frmBane.Img
With Monster1
.Picture = LoadPicture(App.Path & Drag.Pic1)
.Left = Drag.StartPosL
.Top = Drag.StartPosT
End With
And I've created an Image with the picture of a dragon. However, I am not able to control the Image Control directly from the Class Module, something which is vitally dramatic when I'm trying to build the Method called 'MoveDragon'. So I wonder, does anyone have an idea on how to Either:
Give my dragon class a picture, Left and Top Property OR
Give my dragon full authorization of controling the Image Control.
-
Apr 29th, 2001, 04:16 PM
#2
Good Ol' Platypus
It's because 'monster1 as image' makes a MEMORY image; not on any form.
You could have a picturebox property for the 'Drage' and then link a picturebox to it ByRef (IMPORTANT !), and then control it that way.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Apr 29th, 2001, 04:27 PM
#3
Thread Starter
Hyperactive Member
Hmmm
Really...Explain, please. I'm new at theese sort of things.
-
Apr 29th, 2001, 05:22 PM
#4
Good Ol' Platypus
Well, make a PROPERTY in your 'Drage' CLASSMODULE called Linked, and make it's TYPE be PICTUREBOX.
Then, when you say: Public Drag as New Drage, follow it with:
Drag.Linked = Picture1
Then, you can say stuff in your classmodule like:
'varLinked = a local copy
varLinked.Left = 150i0912871 'whatever
varLinked.Picture = 1092578rqfkjacs 'once again, whatever
varLinked.Bottom = 29751q09jfsa;lz
or...
DONT make a LINKED PROPERTY.
Have a thing that translates codes from the classmodule into the form:
Picture1.Left = Drag.Left
Picture1.Top = Drag.Top
Picture1.Picture = Drag.Picture
...
etc.
Do you get what I mean?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Apr 30th, 2001, 02:35 AM
#5
Thread Starter
Hyperactive Member
Humpdi
Yeah, I think I get what you mean, but what can I use to translate code from the class module to the form?
Picture1.Picture = LoadPicture(AZpp.Path & Drag.Pic1)
will not be accepted in the class module.... so?
There's probably some silly things i've forgot and it all seems very stupid, but....how?
-
Apr 30th, 2001, 05:27 AM
#6
transcendental analytic
Your original idea makes more sense, having an image reference wrapped by the drage class, at least from a OOP point of view.
The image should thought be assigned by using a call, using a property. Monster1 has to be module scope.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 30th, 2001, 08:16 AM
#7
Ok, first, to make a reference to a control, you have to SET Drage.Linked = Picture1. Second, the code should be App.Path & "\" & Drag.Pic. Just a few points.
Z.
-
Apr 30th, 2001, 06:47 PM
#8
Thread Starter
Hyperactive Member
YES!
Zaei, you're an angel. However, the coding would not be
LoadPicture(App.Path & "\" Drag.Pic2) as I use the backslash in my pic2 property, with that I mean
With Drag
.Pic2 = "\holaSenorite.Gif"
end With
or similar...However, the SET thing helped me out a lot! I owe you one. Take Care, Bye for now!
-
Apr 30th, 2001, 10:44 PM
#9
Good Ol' Platypus
Oh yeah, but I did nothing....
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 1st, 2001, 07:11 AM
#10
Good Ol' Platypus
No!
It was sarcastic, it's okay.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|