//-------------------------------------------------------------------------------------------------- // Draw - Low Level private void printLine( Graphics graph, bool filled, float x1, float y1, float x2, float y2, int colorInside, int width, bool dash, int colorOut, bool rounded) { /* RECT tR = null; int lResult = 0; int hRPen = 0; if (dash) { hRPen = CreatePen(PS_DOT, width, mAux.translateColor(colorOut)); } else { hRPen = CreatePen(PS_SOLID, width, mAux.translateColor(colorOut)); } DeleteObject(SelectObject(hDC, hRPen)); if (rounded) { x1 = x1 / Screen.TwipsPerPixelX; x2 = x2 / Screen.TwipsPerPixelX; y1 = y1 / Screen.TwipsPerPixelY; y2 = y2 / Screen.TwipsPerPixelY; y1 = y1 * m_scaleY; y2 = y2 * m_scaleY; x1 = x1 * m_scaleX; x2 = x2 * m_scaleX; RoundRect(hDC, x1, y1, x2, y2, 20 * m_scaleX, 20 * m_scaleY); } else { tR = cGlobals.newRectangle(x1, y1, x2, y2); mAux.rectTwipsToPixel(tR, m_scaleX, m_scaleY); if (y2 != y1 && x1 != x2) { Rectangle(hDC, tR.left, tR.top, tR.right, tR.bottom); if (filled) { int hBrush2 = 0; InflateRect(tR, -1, -1); hBrush2 = CreateSolidBrush(mAux.translateColor(colorInside)); lResult = FillRect(hDC, tR, hBrush2); DeleteObject(hBrush2); } } else { if (tR.bottom == 0 || tR.bottom == tR.top) { tR.bottom = tR.top + 1; } if (tR.right == 0 || tR.left == tR.right) { tR.right = tR.left + 1; } Rectangle(hDC, tR.left, tR.top, tR.right, tR.bottom); } } DeleteObject(hRPen); */ Pen pen; pen = new Pen(cColor.colorFromRGB(colorOut), width); if (dash) { pen.DashStyle = DashStyle.Dot; } if (rounded) { y1 = y1 * m_scaleY; y2 = y2 * m_scaleY; x1 = x1 * m_scaleX; x2 = x2 * m_scaleX; cGraphics extGraph = new cGraphics(graph); extGraph.DrawRoundRectangle(pen, x1, y1, x2-x1, y2-y1, 8f); } else { Rectangle rect = cGlobals.newRectangle(Convert.ToInt32(x1), Convert.ToInt32(y1), Convert.ToInt32(x2), Convert.ToInt32(y2)); if (y2 != y1 && x1 != x2) { if (filled) { /* TODO: remove me after some testing * if (!(rect.Height == 1 && filled)) { rect.Inflate(-1, -1); } */ Brush brush = new SolidBrush(cColor.colorFromRGB(colorInside)); graph.FillRectangle(brush, rect); brush.Dispose(); } // the original version didn't put a border when the height is 20 twips // we want to preserve that behaviour // if (!(rect.Height == 1 && filled)) { graph.DrawRectangle(pen, rect); } } else { if (rect.Height == 0 || rect.Bottom == rect.Top) { rect.Height = 1; } if (rect.Width == 0 || rect.Left == rect.Right) { rect.Width = 1; } graph.DrawRectangle(pen, rect); } } pen.Dispose(); }