PDA

Click to See Complete Forum and Search --> : Draw graphics on user forms in excel 2002


M0RRIS
Mar 28th, 2005, 08:22 AM
I am trying to draw a line in an image control on a user form using VBA (Excel 2002). When using MoveToEx and LineTo (API) I'm supposed to declare an argument called "hdc".

Private Declare Function LineTo Lib "gdi32" Alias "LineTo" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long

Since the Image control doesn't have a property called hdc i can't use LineTo. I have also tried to find other controls wich have a hdc property, but I can't seem to find one (such as the Picture contol in VBA 6.0).

If anyone could help me with this I'd be grateful.

RobDog888
Mar 31st, 2005, 11:20 PM
Welcome to the Forums M0RRIS.

You could create your own user control which would be nothing more then a wrapper around the vb6 picturebox
control. Not very elegant or simple but it may work.

Just remembering that there may be an API that could create an hDC. Try a search over at allapi.net for the API.