Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the Picture Object to work 1

Status
Not open for further replies.

jeremy2300

Technical User
Feb 11, 2003
7
US
program: Visual Studio 6 -- no service packs

Hi,
I've been reading about the picture object and it seems
to be what I'm looking for. The problem is that my visual
basic program doesn't seem to recognize the object.

*Using stdPicture isn't much more helpful but vb 'sees' it.
I get the same thing as for Picture
--------
ex: Dim pic as Picture
-usually i get a popup window and can see all the types
but 'picture' is not in there.

If i go ahead and use it anyway I seem to have a very
limited group of properties & methods. (They are the same
as the picture property, I believe)

This is nowhere near it's description at:

url=/library/en-us/vbcon98/html/vbconthepictureobject.asp

--This link states, in part:
...There are lots of things you can do with bitmaps, icons,
or metafiles in the Windows API, but the Picture object
already does most of them for you...

How do I make VB 'see' and allow me to use the Picture Object?
 
It's a control. Look at your toolbar find the guy that looks like a picture, also there is an Image Control.
 
No, the Picture object is not a control. It is a VB object that, along with StdPicture from the stdole library, implements the IPictureDisp and IPicture interfaces. IPicture is a hidden interface, with a few more properties and methods than IPictureDisp. Picture and StdPicture expose the IPictureDisp interface by default, although you can use the IPicture interface instead if you like.

Private Sub Command1_Click()

Dim myPicture As Picture ' myPicture is an Picture object that implements the IPictureDisp interface
Dim myIPicture As IPicture ' myIPicture uses an IPicture interface
Dim myIPictureDisp As IPictureDisp 'myIPictureDisp uses an IPictureDisp interface
Dim myStdPicture As StdPicture ' myStdPicture is a StdPicture object that implements the IPictureDisp interface


Set myPicture = LoadPicture("c:\tinyhorde.jpg") ' Load your own picture image here
Set myIPicture = myPicture
Set myIPictureDisp = myPicture
Set myStdPicture = myPicture

' effectively myPicture, myIPictureDisp, and myStdPicture all have the same properties and methods
' since they are all expose the IPictureDisp interface for the underlying object
' myIPicture, whilst referring to the same object as all the others, exposes a slightly extended set
' of properties and methods, since it implements the IPicture interface rather than the
' IPictureDisp interface

Beep ' Put a break on this line, and then you can examine the properties of the objects
End Sub
 
Thanks strongm,
That helps clear things up a little. I don't see a way to use the iPicture type to print text like I can using a picture box, but I've got a bunch of things to research now and I'm sure I'll figure something out. I'll probably end up having to use the API but I hope not :)
--------
For anybody that is interested, I've found a good book on VB on-line at:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top