CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Region

  1. #1
    Join Date
    May 1999
    Posts
    3

    Region

    Hello,

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

    Thanks a lot
    Nathalie


  2. #2
    Join Date
    Jul 1999
    Posts
    145

    Re: Region

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured