On 6/8/07, Dmitry Timoshkov <[EMAIL PROTECTED]> wrote:
"Evan Stade" <[EMAIL PROTECTED]> wrote:> +GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1, > + INT y1, INT x2, INT y2) > +{ > + HGDIOBJ old_obj; > + > + if(!pen || !graphics) > + return InvalidParameter; > + > + old_obj = SelectObject(graphics->hdc, pen->gdipen); > + MoveToEx(graphics->hdc, x1, y1, NULL); > + LineTo(graphics->hdc, x2, y2); > + SelectObject(graphics->hdc, old_obj); > + > + return Ok; > +} > + > +GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, > + INT y, INT width, INT height) > +{ > + LOGBRUSH lb; > + HPEN hpen; > + HGDIOBJ old_obj; > + > + if(!pen || !graphics) > + return InvalidParameter; > + > + lb.lbStyle = BS_SOLID; > + lb.lbColor = pen->color; > + lb.lbHatch = 0; > + > + hpen = ExtCreatePen(PS_GEOMETRIC | PS_ENDCAP_SQUARE, (INT) pen->width, > + &lb, 0, NULL); Any reason why are you creating a new pen in GdipDrawRectangleI, and while using an existing one in GdipDrawLineI? -- Dmitry.
Yes, the reason for that is the passed pen can have any endcap style, but to draw the rectangle the pen needs square endcaps. The same does not apply to DrawLine.
