我的ondraw函数:
void CColorLedCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
CRect rect;
rect.SetRect(rcBounds.left,rcBounds.top,rcBounds.Width(),rcBounds.Height());
CBrush brush;
brush.CreateSolidBrush(RGB(255,0,0));
pdc->FillRect(&rect,&brush);
brush.DeleteObject();
}
onsize
void CColorLedCtrl::OnSize(UINT nType, int cx, int cy)
{
COleControl::OnSize(nType, cx, cy);
// TODO: Add your message handler code here if (::IsWindow(this->GetSafeHwnd()))
{
CRect rc;
this->GetWindowRect(&rc);
if (rc.Width()!=m_iWidth || rc.Height()!=m_iHeight)
{
::MoveWindow(this->GetSafeHwnd(),rc.left,rc.top,m_iWidth,m_iHeight,TRUE);
this->Invalidate();
}
}
}
是不是要处理什么其它消息?
void CColorLedCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
CRect rect;
rect.SetRect(rcBounds.left,rcBounds.top,rcBounds.Width(),rcBounds.Height());
CBrush brush;
brush.CreateSolidBrush(RGB(255,0,0));
pdc->FillRect(&rect,&brush);
brush.DeleteObject();
}
onsize
void CColorLedCtrl::OnSize(UINT nType, int cx, int cy)
{
COleControl::OnSize(nType, cx, cy);
// TODO: Add your message handler code here if (::IsWindow(this->GetSafeHwnd()))
{
CRect rc;
this->GetWindowRect(&rc);
if (rc.Width()!=m_iWidth || rc.Height()!=m_iHeight)
{
::MoveWindow(this->GetSafeHwnd(),rc.left,rc.top,m_iWidth,m_iHeight,TRUE);
this->Invalidate();
}
}
}
是不是要处理什么其它消息?
解决方案 »
- 关于创建表,这样的想法,看看行不行,
- ComboBox前缀相同时的定位问题
- 打开多个非模态对话框, 现在我按下一个按钮就把全部非模态对话框关闭 马上给分!!
- 如何访问一个网页
- 如何使得Spin控件不给宿主类发送WM_VSCROLL消息
- 请问有没有可能通过实例句柄HINSTANCE或HANDLE来获得此程序所有DialogBox的HWND?
- 请教高手!
- 在VC里不知不小心按了哪个键,所有输入TAB制表符都显示为尖角,怎么改回来啊?
- 使用ScrollWindow平滑滚动文本框的文本
- 关于MFC多线程控制多个软件执行顺序怎么实现
- 一个编译生成dll的问题
- COM 内部调用其它COM事件的问题,来者有分
需要看看m_iWidth 和m_iHeight 的值。