CEdit控件在OnPaint函数中,用CDC画了个矩形边框后(Rectangle)后,编辑框当鼠标移走时看不到刚刚输入的内容了,甚么原因?
解决方案 »
- 请各位前辈指点一下...(关于学习步骤和方向)
- 求教怎么用SetClassLong改变鼠标光标
- 怎么编写插件
- 用udp传送数据的时候能不能修改数据包头的协议号的?
- 谁了解或用过 "VXIplug&play Framework" 吗?
- 关于DptoLp的弱弱问题
- 一个MFC SDI 客户端、服务端接收、发送的例子?
- Win98下 windows media player 或其控件用一段时间后就不能正常播放MP3,谁遇到过?
- 在MainFrm里创建的toolbar为何只显示一个很窄的横条???
- 鼠标经过时ListCtrl时让某行改变背景色
- 在ACTIVEX里面应用BCG的问题
- 哪里可以下载msdn英文版????急!!!!
void MyEdit::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rect;
GetWindowRect( &rect );
CPen pen(PS_SOLID,2,RGB(255,0,0));
CPen *old_pen = dc.SelectObject(&pen);int w = rect.Width() - 2 ;
int h = rect.Height() - 2;
dc.MoveTo(0,0);
dc.LineTo(w,0);
dc.LineTo(w,h);
dc.LineTo(0,h);
dc.LineTo(0,0);dc.SelectObject(old_pen);
}
// do not remove
// this algoritm is calculated client size with use or not horizontal
// and vertical scroll bars
RectEditControl.top -= m_bHorizontalFrameWidth; RectEditControl.bottom += m_iHorizontalScrollWidth;
RectEditControl.bottom += m_bHorizontalFrameWidth; RectEditControl.right += m_iVerticalScrollWidthRight;
RectEditControl.right += m_bVerticalFrameWidth; RectEditControl.left -= m_iVerticalScrollWidthLeft;
RectEditControl.left -= m_bVerticalFrameWidth; CPen *OldPen = pEditControlDC->GetCurrentPen();
CPen newPen(PS_SOLID, 1, RGB(255,0,0));
pEditControlDC->SelectObject(&newPen); // 画个边框
pEditControlDC->Rectangle(RectEditControl.left, RectEditControl.top,
RectEditControl.right, RectEditControl.bottom);
pEditControlDC->SelectObject(OldPen); // Release DC ! do not remove!
ReleaseDC (pEditControlDC);
Draws a rectangle using the current pen. The interior of the rectangle is filled using the current brush.
已经覆盖了EDIT文本框....
你还是用我提供的画四条线的方法来解决