VB.NET, cards.dll, PictureBox

VB.NET, cards.dll, PictureBox

Post by Adam Lawrenc » Tue, 10 Sep 2002 04:12:34



I'm using VB.NET and want to use cards.dll (32-bit version) to render cards
onto various PictureBox controls.

I'm having a*ens of a time getting a device context from a PictureBox in
order to make the DLL call work. I tried to use the API call GetDC using the
PictureBox .Handle property, but that didn't work.

Any advice as to how to get a DC for a PictureBox would be greatly
appreciated!
Declare Function GetDC Lib "user32" (ByVal hwnd As IntPtr) As Long

Declare Function cdtDraw Lib "Cards32.Dll" (ByVal hdc As Long, ByVal X As
Long, ByVal Y As Long, ByVal cardValue As Long, ByVal cardSuit As Long,
ByVal rgbColor As Long) As Boolean

...

cdtDraw(GetDC(pbxCPUCard1.Handle), 0, 0, CardBack, CPU.Hand(0).Suit, 0) <-
does nothing

 
 
 

VB.NET, cards.dll, PictureBox

Post by Mike D Sutto » Tue, 10 Sep 2002 05:47:28


Quote:> I'm using VB.NET and want to use cards.dll (32-bit version) to render
cards
> onto various PictureBox controls.

> I'm having a*ens of a time getting a device context from a PictureBox
in
> order to make the DLL call work. I tried to use the API call GetDC using
the
> PictureBox .Handle property, but that didn't work.

<snip>

Try the .hDC property if it exists in VB.NET if not then try asking the
question in a .NET newsgroup, this is not.
Also if you want to use GetDC then you should really enable the AutoRedraw
property as it does some strange stuff in the background with it's internal
Bitmaps, and always remember to pair up your GetDC call with one to
ReleaseDC()
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: http://www.veryComputer.com/