|
-
July 16th, 2001, 03:11 AM
#1
Draw an activeX control
Hello,
Can anyone tell me how to draw an activeX control. I 've a PictureBox which I want to fill with an image of ActiveX control. The image should have the same size as the current size of the picturebox.
I know that an ActiveX control can draw itself (IVIewobject: raw), but i don't know how to get the image (of a specific size) of an activeX control in VB.
I tried to do it like this (with the OleDraw API function):
public Type RECT
Left as Long
Top as Long
Right as Long
Bottom as Long
End Type
public Declare Sub OleDraw Lib "ole32.dll" (byval pUnknown as Long, byval dwAspect as Long, byval hdcDraw as Long, byref lprcBounds as RECT)
public sub CopyControlImage(SourceControl as object, TargetConrol as PictureBox)
Dim udtRect as RECT
udtRect.Bottom = SourceControl .Height
udtRect.Left = 0
udtRect.Top = 0
udtRect.Right = SourceControl.Width
'Clear the picture
TargetConrol.Picture = LoadPicture()
'Load picture image into a PictureBox control
OleDraw SourceControl, 1, TargetConrol.hdc, udtRect
'Repaint
TargetConrol.refresh
end sub
Hope to hear from you soon, Thanx in advance!!!!
Raymond Koning
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
|