-
March 4th, 2009, 04:25 AM
#1
[RESOLVED] Problem with LoadPicture in an ActiveX Control
Hi guys, a problem and I have no promising clue:
I have created an activeX control which has a PictureBox. I have exposed Picture property like this:
(Picture1 is the name of constituent PictureBox drawn on UserControl)
Code:
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=Picture1,Picture1,-1,Picture
Public Property Get Picture() As Picture
Attribute Picture.VB_Description = "Returns/sets a graphic to be displayed in a control."
Set Picture = Picture1.Picture
End Property
Public Property Set Picture(ByVal New_Picture As Picture)
Set Picture1.Picture = New_Picture
PropertyChanged "Picture"
End Property
Now when I try to use this property in a form at run time:
Code:
Picture1.Picture = LoadPicture("d:\xyz.jpg") 'Picture1 is my activeX control
Picture2.Picture = LoadPicture("d:\xyz.jpg") 'Picture2 is a VB picture Box
For Picture1, I get "Invalid use of property" compile error.
However, if I comment line1 and run, it runs normally for Picture2.
Then I tried changing data type Picture to StdPicture and IPictureDisp in Get and Let, but got same error.
I have confirmed that LoadPicture is indeed referring to VB.Loadpicture and not something else in my code.
Please not that I can set the picture alright at design time from properties windows. The error occurs only at run time. Also I haven't coded the property manually, it has been added by VB's ActiveX Interface Wizard.
My aim is to use LoadPicture normally for my activeX control as we use for a PictureBox. Alternative implementation of Get and Let for Picture property will also do. Only condition is that it should work as normal PictureBox.
I have exposed all the properties of PictureBox in my control, but so far only LoadPicture has given problem.
Thanks for your time.
Tags for this Thread
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
|