Click to See Complete Forum and Search --> : Region


Nathalie
July 25th, 1999, 05:54 AM
Hello,

I would like to create a region from a bitmap. How can I do this in VB?

Thanks a lot
Nathalie

Mikesc
July 29th, 1999, 09:59 AM
As far as I know you don't create a region FROM anything except coordinate points. You can create a region and select a bitmap into it though easily.

Call CreateRectRgn

rec=CreateRectRgn(Left, Top, Right, Bottom)

Select the region into a DC

oldDC=SelectClipRgn(Form1.hdc, rec)

Then just blit the bitmap onto the DC at the regions coordinates. When you select the region into the DC, the region accepts the blit, like the region takes over the whole DC. So if your blit runs outside of the region the excess area is clipped.

Lastly, clean up

rec=SelectClipRgn(Form1.hdc,oldDC)

DeleteObject rec

You can also use DrawEdge to give the Bitmap a sunken or raised 3d effect.