Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
combinergn (gdi32)

C# Signature:

static extern int CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1,
   IntPtr hrgnSrc2, int fnCombineMode);

VB.Net Signature:

Private Shared Function CombineRgn(ByVal hrgnDest As IntPtr,
   ByVal hrgnSrc1 As IntPtr, ByVal hrgnSrc2 As IntPtr,
   ByVal fnCombineMode As Integer) As Integer
End Function

User-Defined Types:

public enum CombineRgnStyles:int
    RGN_AND         =1,
    RGN_OR          =2,
    RGN_XOR         =3,
    RGN_DIFF        =4,
    RGN_COPY        =5,
    RGN_MIN         =RGN_AND,
    RGN_MAX         =RGN_COPY

Return Values:

public const int ERROR = 0;
public const int NULLREGION = 1;
public const int SIMPLEREGION = 2;
public const int COMPLEXREGION = 3;



Tips & Tricks:

Please add some!

Sample Code:

// This Sample xors the two different shapes and redraw the complete window by the resultant shapes

    public static extern IntPtr CreateEllipticRgn(int nLeftRect, int nTopRect,int nRightRect, int nBottomRect);

    static extern System.UInt16  SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw);

    static extern int CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1,IntPtr hrgnSrc2, int fnCombineMode);

// And the code lies here


            IntPtr r1 = CreateEllipticRgn(0,0,300,300);
            IntPtr r2 = CreateEllipticRgn(100,100,300,300);
            IntPtr r3= CreateEllipticRgn(100,100,300,300);

// by - S.C.

Alternative Managed API:

Do you know one? Please contribute it!

CombineRgn on MSDN

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version