home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!kithrup!hoptoad!decwrl!sdd.hp.com!uakari.primate.wisc.edu!ames!bionet!raven.alaska.edu!news.u.washington.edu!milton!bytor
- From: bytor@milton.u.washington.edu (Jill Patterson)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: BC++ OWL TEdit Questions
- Message-ID: <bytor.714343854@milton>
- Date: 20 Aug 92 20:50:54 GMT
- Sender: news@u.washington.edu (USENET News System)
- Organization: University of Washington
- Lines: 69
-
- Hi,
- I am trying to derive a class from TEdit Called TXEdit, I
- am trying to draw a custom frame around the Edit Box. A problem
- I am encountering is when the window containing the TXEdit Is moved
- the Text inside the Edit Box Is no longer visible. Here Is the code
- for My WM_NCPAINT handler, where I Paint The Frame:
-
- /*
- ** TXEdit::WMNCPaint()
- */
- void TXEdit::WMNCPaint(RTMessage Msg)
- {
- HBRUSH hBrFrame;
- HPEN hDkGrayPen;
- HPEN hOldPen;
- PAINTSTRUCT ps;
- RECT rc;
-
- /* Setup */
- BeginPaint(HWindow, &ps);
- GetClientRect(HWindow, &rc);
- InflateRect(&rc, 1, 1);
-
- hBrFrame = CreateSolidBrush(RGB(0, 0, 0));
- hDkGrayPen = CreatePen(PS_SOLID, 1, RGB(72, 72, 72));
-
- /* Draw Lower Right Corner */
- if(fBorderState)
- hOldPen = (HPEN)SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
- else
- hOldPen = (HPEN)SelectObject(ps.hdc, hDkGrayPen);
-
- MoveTo(ps.hdc, rc.right - 1, rc.top);
- LineTo(ps.hdc, rc.right - 1, rc.bottom - 1);
- LineTo(ps.hdc, rc.left, rc.bottom - 1);
-
-
- /* Draw Upper Left Corner */
- if(fBorderState)
- SelectObject(ps.hdc, hDkGrayPen);
- else
- SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
-
- MoveTo(ps.hdc, rc.left, rc.bottom - 1);
- LineTo(ps.hdc, rc.left, rc.top);
- LineTo(ps.hdc, rc.right, rc.top);
-
- InflateRect(&rc, -1, -1);
- FrameRect(ps.hdc, &rc, hBrFrame);
-
- /* Cleanup */
- SelectObject(ps.hdc, hOldPen);
- DeleteObject(hDkGrayPen);
- DeleteObject(hBrFrame);
- EndPaint(HWindow, &ps);
-
- }
-
- Also I am drawing the frame outside of the actual window, because
- I call InflateRect with neg parms. Will this be a problem?
-
- I was thinking of maybe putting another InflateRect(&rc, -1, -1) at
- the end after the EndPaint, and then calling InvalidateRegion(ps.hdc,
- &rc, TRUE). Would this be the best way to accomplish this?
-
- THX
- bytor@milton.u.washington.eud
-
- oops thats edu
-