// int ReleaseDC(HWND hWnd, HDC hDC) public static int ReleaseDC(int hWnd, int hDC) { WinDC dc = WinDC.get(hDC); if (dc == null) return 0; if (dc.isScreen()) { Main.drawImage(dc.getImage()); } dc.close(); return 1; }
// BOOL Rectangle(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) public static int Rectangle( int hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { WinDC dc = WinDC.get(hdc); if (dc == null) return FALSE; if (nLeftRect == nRightRect || nTopRect == nBottomRect) return TRUE; WinPen pen = WinPen.get(dc.hPen); WinBrush brush = WinBrush.get(dc.hBrush); if (pen == null || brush == null) return FALSE; int width = nRightRect - nLeftRect - 1; int height = nBottomRect - nTopRect - 1; Graphics2D graphics = dc.getGraphics(); Rectangle rectangle = new Rectangle(dc.x + nLeftRect, dc.y + nTopRect, width, height); // inside if (brush.setPaint(graphics)) graphics.fill(rectangle); // border if (pen.setStroke(dc, graphics)) graphics.draw(rectangle); graphics.dispose(); if (dc.getImage() == StaticData.screen.getImage()) Main.drawImage(dc.getImage()); return TRUE; }