DIALOG拖动标 我在DIALOG放票一个图标,要怎么要才能用mouse拖放到窗休体任意位置呀 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 重载CStatic类,设置Notify属性// CNewStatic类H文件#if !defined(AFX_NEWSTATIC_H__FAC16146_DC25_42CA_9D81_38A03FA49932__INCLUDED_)#define AFX_NEWSTATIC_H__FAC16146_DC25_42CA_9D81_38A03FA49932__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000// NewStatic.h : header file///////////////////////////////////////////////////////////////////////////////// CNewStatic windowclass CNewStatic : public CStatic{// Constructionpublic: CNewStatic();// Attributesprivate: BOOL m_bDown; CPoint m_pt; CRect m_rc;// Operationspublic:// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CNewStatic) //}}AFX_VIRTUAL// Implementationpublic: virtual ~CNewStatic(); // Generated message map functionsprotected: //{{AFX_MSG(CNewStatic) afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP()};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_NEWSTATIC_H__FAC16146_DC25_42CA_9D81_38A03FA49932__INCLUDED_)------------------------------------------// CNewStatic类CPP文件// NewStatic.cpp : implementation file//#include "stdafx.h"#include "NewStatic.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CNewStaticCNewStatic::CNewStatic(){ m_bDown = FALSE; m_pt.x = 0; m_pt.y = 0; m_rc.SetRectEmpty();}CNewStatic::~CNewStatic(){}BEGIN_MESSAGE_MAP(CNewStatic, CStatic) //{{AFX_MSG_MAP(CNewStatic) ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() ON_WM_MOUSEMOVE() //}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CNewStatic message handlersvoid CNewStatic::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default SetCapture(); m_bDown = TRUE; m_pt = point; GetWindowRect(m_rc); GetParent()->ScreenToClient(m_rc); CStatic::OnLButtonDown(nFlags, point);}void CNewStatic::OnLButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default ReleaseCapture(); m_bDown = FALSE; CStatic::OnLButtonUp(nFlags, point);}void CNewStatic::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CStatic::OnMouseMove(nFlags, point); if(m_bDown) { int cx = point.x - m_pt.x; int cy = point.y - m_pt.y; int nWidth = m_rc.Width(); int nHight = m_rc.Height(); m_rc.left += cx; m_rc.top += cy; m_rc.right = m_rc.left + nWidth; m_rc.bottom = m_rc.top + nHight; MoveWindow(m_rc); }} 用CRectTracker类,很容易实现.网上有例子,我的资源中也有这样的例子 窗口最小化后内存大大减少,但虚并不增加。 请问 : 有关邮件还原的问题 LED点阵显示屏发送程序问题?绝对难题!!! 请教一下自定义控件(Custom Control)的用法 为何不能处理多幅图片呢?谢谢! 简单的问题,请指教 怎样编译html文件成帮助文件 请问有几种方法可以加载DLL 学校网速惊人(快),家里网速也惊人(慢),要解决这个矛盾该怎么办?? 菜鸟问题:怎样动态加载一张位图 ManuItem 事件 为什么调试跟不进去呢? 大文本问题
#if !defined(AFX_NEWSTATIC_H__FAC16146_DC25_42CA_9D81_38A03FA49932__INCLUDED_)
#define AFX_NEWSTATIC_H__FAC16146_DC25_42CA_9D81_38A03FA49932__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// NewStatic.h : header file
///////////////////////////////////////////////////////////////////////////////
// CNewStatic windowclass CNewStatic : public CStatic
{
// Construction
public:
CNewStatic();// Attributes
private:
BOOL m_bDown;
CPoint m_pt;
CRect m_rc;
// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewStatic)
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CNewStatic(); // Generated message map functions
protected:
//{{AFX_MSG(CNewStatic)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//}}AFX_MSG DECLARE_MESSAGE_MAP()
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_NEWSTATIC_H__FAC16146_DC25_42CA_9D81_38A03FA49932__INCLUDED_)------------------------------------------
// CNewStatic类CPP文件
// NewStatic.cpp : implementation file
//#include "stdafx.h"
#include "NewStatic.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CNewStaticCNewStatic::CNewStatic()
{
m_bDown = FALSE;
m_pt.x = 0;
m_pt.y = 0;
m_rc.SetRectEmpty();
}CNewStatic::~CNewStatic()
{
}
BEGIN_MESSAGE_MAP(CNewStatic, CStatic)
//{{AFX_MSG_MAP(CNewStatic)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CNewStatic message handlersvoid CNewStatic::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
SetCapture();
m_bDown = TRUE;
m_pt = point;
GetWindowRect(m_rc);
GetParent()->ScreenToClient(m_rc);
CStatic::OnLButtonDown(nFlags, point);
}void CNewStatic::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
ReleaseCapture();
m_bDown = FALSE;
CStatic::OnLButtonUp(nFlags, point);
}void CNewStatic::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CStatic::OnMouseMove(nFlags, point); if(m_bDown)
{
int cx = point.x - m_pt.x;
int cy = point.y - m_pt.y;
int nWidth = m_rc.Width();
int nHight = m_rc.Height();
m_rc.left += cx;
m_rc.top += cy;
m_rc.right = m_rc.left + nWidth;
m_rc.bottom = m_rc.top + nHight;
MoveWindow(m_rc);
}
}