Image control DC

  • Thread starter Thread starter Mile510
  • Start date Start date
M

Mile510

Hi,
Does Image control have a DC?
If yes, how to find it?

Thanks.
Mike.
 
Hi Mile510,
A control image does not have a hdc, but a userform yes. If you place the
image on the userform, you can recover the hdc with:
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub UserForm_Initialize()
Dim MehDC As Long
MehDC = GetDC(FindWindow(vbNullString, Me.Caption))
End Sub

MP
 
Dear Mr. Pierron,
thank you very much for your detailed reply. The same advice was give to me
by Mr. Stephen Bullen earlier. But this way I will plot on a form itself and
not on an Image control. For example, in VB there is a Picture Box comtrol
which does have a hDC. And people can access it with Picture.hDC property.
As I do not have VB, I assume that Image in VBA is the same as Picture Box
in VB. It seems that I am wrong and lost. How can I plot or do other API
things with Image control only? Or should I try completely diffrent
approach?

Thank you again.

Mike.
 
Mike510 said:
I assume that Image in VBA is the same as Picture Box
in VB.

Not quite. A VB picturebox is a container object. Userform controls
that are containers include frame and mulipage which do have a hWnd
(but is hard to find without a caption <g>).

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top