Jump to content
Xtreme .Net Talk

Recommended Posts

Guest Cokegod
Posted

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 can't get the raster ops to work(ie srccopy)

 

Thanks

  • *Gurus*
Posted

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. Don't forget to call the ReleaseHdc method when you're done!

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • *Gurus*
Posted
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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Guest Cokegod
Posted
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.
Guest Cokegod
Posted

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

Guest Cokegod
Posted
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
Guest Cokegod
Posted

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???

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...