Bitblt

  • Thread starter Thread starter Cokegod
  • Start date Start date
C

Cokegod

Guest
I can not figure out how to get BitBlt to work in VB.Net.
I use the function call of:

Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal dwRop As Long) As Long

But there are longer any hdc that i can find and i cant get the raster ops to work(ie srccopy)

Thanks
 
Avoid using these APIs if at all possible, .NET has GDI+ functions which do pretty much everything you need, except raster ops.

You *can* use BitBlt successfully, but in order to get an hDC you must call the GetHdc method of the Graphics class. Dont forget to call the ReleaseHdc method when youre done!
 
Oh, and your declare statement is going to have to change too. Wherever you see a Long datatype in an API declare, change it to Integer. Also, some of those Integers are going to have to be IntPtrs, certainly when you actually pass an hDC to it.
 
so is there a way that GDI+ will do a transparent background for a bitmap. EX set the color to white so whereever there is white in the bitmap i will see the form or whatever is underneath the picture.
 
If I use the maketransparent method on a bitmap then put it into a picture box, it will take what ever the "main" color of the bitmap is and make that the background. I have a basically yellow pic with a white background and when i call myimage.maketransparent(white) it goes yellow.
???
Thanks
 
Nevermind the colors later in my code i changed the backcolor, but now that i never change the backcolor they still go gray rather than transparent
 
Sorry that last post was illegible. What i was trying to say was that the multiple colors was a mistake i found later in my code, BUT the back color changes to gray when i call the make transparent.
Does putting the bitmap into an imagebox change the transparency back to a color???
 
Back
Top