我在MFC中创建了一个CBUTTON的类,用于做主窗体BUTTON1按钮的ONCLICKUP和DOWN事件,执行了以下代码出错?
#include"stdafx.h"#include"text.h"#include"SET1.h"#include"textDlg.h"IMPLEMENT_DYNAMI...
#include "stdafx.h"#include "text.h"#include "SET1.h"#include "textDlg.h"IMPLEMENT_DYNAMIC(SET1, CButton)SET1::SET1(){}SET1::~SET1(){}BEGIN_MESSAGE_MAP(SET1, CButton) ON_WM_LBUTTONUP() ON_WM_LBUTTONDOWN()END_MESSAGE_MAP()void SET1::OnLButtonUp(UINT nFlags, CPoint point){ // TODO: 在此添加消息处理程序代码和/或调用默认值 //CDC* pDC; RECT ClientRect; CWnd* pWnd = GetDlgItem(IDC_STATIC1); CDC *pDC = pWnd->GetDC(); ReleaseDC(pDC); ((CWnd*)GetDlgItem(IDC_STATIC1))->GetClientRect(&ClientRect); CBrush fillBrush(RGB(255,0,0)); pDC->FillRect(&ClientRect,&fillBrush); ((CWnd*)GetDlgItem(IDC_STATIC1))->ReleaseDC(pDC); CButton::OnLButtonUp(nFlags, point);}void SET1::OnLButtonDown(UINT nFlags, CPoint point){ // TODO: 在此添加消息处理程序代码和/或调用默认值 CButton::OnLButtonDown(nFlags, point);
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询