public static Point GetScreenPoint(String key, IntPtr pWnd) { Point point = getPointFromConfig(key); Rectangle wndRect = ScreenHelpers.getClientRect(pWnd); return(new Point(point.X + wndRect.X, point.Y + wndRect.Y)); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // 画图 Graphics dc = e.Graphics; Pen pen = new Pen(Color.Red, 1); Font font = new Font("Tahoma", 8); Brush brush = (Brush)Brushes.Red; Rectangle rectIE = ScreenHelpers.getClientRect(pWnd); Point point; Rectangle rect; dc.DrawRectangle(pen, rectIE); // 价格 rect = Configuration.GetScreenRect(Configuration.CONFIG_PRICE_RECT, pWnd); dc.DrawRectangle(pen, rect); // 时间 rect = Configuration.GetScreenRect(Configuration.CONFIG_TIME_RECT, pWnd); dc.DrawRectangle(pen, rect); // 加价 point = Configuration.GetScreenPoint(Configuration.CONFIG_INC_IN_POINT, pWnd); dc.FillRectangle(brush, point.X, point.Y, 5, 5); // 加价确认 point = Configuration.GetScreenPoint(Configuration.CONFIG_INC_BTN_POINT, pWnd); dc.FillRectangle(brush, point.X, point.Y, 5, 5); // 出价 point = Configuration.GetScreenPoint(Configuration.CONFIG_SUBMIT_BTN_POINT, pWnd); dc.DrawString("出价", font, brush, new Rectangle(point.X, point.Y, 40, 15)); // 确认 point = Configuration.GetScreenPoint(Configuration.CONFIG_CONFIRM_BTN_POINT, pWnd); dc.DrawString("确认", font, brush, new Rectangle(point.X, point.Y, 40, 15)); // 取消 point = Configuration.GetScreenPoint(Configuration.CONFIG_CANCEL_BTN_POINT, pWnd); dc.DrawString("取消", font, brush, new Rectangle(point.X, point.Y, 40, 15)); }