GetRandomRegion not working on Windows7

Discussion in 'Windows 7 Graphics' started by Leo H, May 26, 2010.

  1. Leo H

    Leo H New Member

    Joined:
    May 26, 2010
    Messages:
    2
    Likes Received:
    0
    Using the GetRandomRgn function in windows does not work on Windows 7. The forms borders stay visible.

    The following code on XP clears the entire window including borders and enables you to draw on the entire window area.

    The code on Windows 7 clears only the client area and enables you to draw on the client area only

    IntPtr hrgn, hdc;
    hrgn = CreateRectRgn(0, 0, 0, 0);
    hdc = GetWindowDC(hWnd);
    int res = GetRandomRgn(hdc, hrgn, 4); // the value of SYSRGN is 4.
    ReleaseDC(hWnd, hdc);
    SetWindowRgn(hWnd, hrgn, true);
     

Share This Page

Loading...