BUG: Rectangle Fails with Certain ROP2 Codes

ID: Q196373

The information in this article applies to:

SYMPTOMS

Under Windows NT 4.0, the Rectangle API fails to draw if all of the following conditions exist:

1. The width of the currently selected pen is greater than or equal to 2.

2. The edges of the rectangle do not intersect the client area.

3. The current ROP2 code is set to anything but R2_COPYPEN.

If any one of these conditions do not exist, the Rectangle API behaves as documented.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

The following sample code demonstrates the conditions that cause the Rectangle API to fail:

  // Width is 5 so edges will not touch rectclient.
  SelectObject(hdc, CreatePen(0,5,RGB(255,0,0)));
  SetRop2(hdc, <any ROP2 code except R2_COPYPEN>);
  Rectangle(hdc, rectclient.left - 10,  rectclient.top - 10,
                 rectclient.right + 10, rectclient.botom + 10);

RESULT: The call to Rectangle returns TRUE, but it does not draw anything.

Additional query words:

Keywords          : kbAPI kbGDI kbNTOS400bug kbSDKPlatform 
Issue type        : kbbug

Last Reviewed: December 1, 1998