Knowledge Base

BUG: Rectangle Fails with Certain ROP2 Codes

Article ID: 196373

Article Last Modified on 10/15/2002


APPLIES TO


This article was previously published under Q196373

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.

Keywords: kbbug kbapi kbgdi KB196373