有什么办法让CStaic接收鼠标双击消息? 设置WS_NOTIFY属性Static的属性页->Styles->Notify钩上 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己继承一个CStatic类,处理 WM_WM_LBUTTONDBLCLK 就行了 自己继承一个CStatic类,处理 WM_LBUTTONDBLCLK 就行了 我做了个例子:http://61.140.78.114/fjj/test1.zip (91k)快点给分哦~~~~~~ 楼上的朋友,你好,我也试过了,为什么要NOTIFY勾上呢 Sorry设置SS_NOTIFY属性这个属性表示本控件接受某些消息,Static是比较特殊的控件之一 文件要删了,贴源码:// MyStatic.h : header file///////////////////////////////////////////////////////////////////////////////// CMyStatic windowclass CMyStatic : public CStatic{// Constructionpublic: CMyStatic();// Attributespublic:// Operationspublic:// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMyStatic) //}}AFX_VIRTUAL// Implementationpublic: virtual ~CMyStatic(); // Generated message map functionsprotected: //{{AFX_MSG(CMyStatic) afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP()};// MyStatic.cpp : implementation file//#include "stdafx.h"#include "test1.h"#include "MyStatic.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CMyStaticCMyStatic::CMyStatic(){}CMyStatic::~CMyStatic(){}BEGIN_MESSAGE_MAP(CMyStatic, CStatic) //{{AFX_MSG_MAP(CMyStatic) ON_WM_LBUTTONDBLCLK() //}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CMyStatic message handlersvoid CMyStatic::OnLButtonDblClk(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default ::MessageBox(0,"ok.....la","",MB_OK); CStatic::OnLButtonDblClk(nFlags, point);}//////测试:// test1Dlg.h : header file///////////////////////////////////////////////////////////////////////////////// CTest1Dlg dialog#include "mystatic.h"class CTest1Dlg : public CDialog{// Constructionpublic: CTest1Dlg(CWnd* pParent = NULL); // standard constructor// Dialog Data //{{AFX_DATA(CTest1Dlg) enum { IDD = IDD_TEST1_DIALOG }; CMyStatic m_mystatic1; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CTest1Dlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL// Implementationprotected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CTest1Dlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); //}}AFX_MSG DECLARE_MESSAGE_MAP()}; 频繁调用bitblt抓图导致机子很卡 异常 ? unhandle exception ... MFCO42D.DLL 请教高手如何将Cstring类型转换成float? DirectPlay连接不上 利用CFontDialog获取字体属性后,如何从字体名字得到存放该字体的文件路径呢~ 请问vc6里怎么找不到InternetSetCookieEx? 如何用activex将监控组态软件嵌入网页?100分 100分求解CEdit字体设置问题 看"Unix网络编程 第1卷"中,关于C/S之间端口的一个问题 如何往系统鼠标右键菜单上加菜单并添加事件 矢量图形的问题 白捡的高分
设置SS_NOTIFY属性
这个属性表示本控件接受某些消息,Static是比较特殊的控件之一
// MyStatic.h : header file
///////////////////////////////////////////////////////////////////////////////
// CMyStatic windowclass CMyStatic : public CStatic
{
// Construction
public:
CMyStatic();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyStatic)
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CMyStatic(); // Generated message map functions
protected:
//{{AFX_MSG(CMyStatic)
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
//}}AFX_MSG DECLARE_MESSAGE_MAP()
};// MyStatic.cpp : implementation file
//#include "stdafx.h"
#include "test1.h"
#include "MyStatic.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CMyStaticCMyStatic::CMyStatic()
{
}CMyStatic::~CMyStatic()
{
}
BEGIN_MESSAGE_MAP(CMyStatic, CStatic)
//{{AFX_MSG_MAP(CMyStatic)
ON_WM_LBUTTONDBLCLK()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CMyStatic message handlersvoid CMyStatic::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
::MessageBox(0,"ok.....la","",MB_OK); CStatic::OnLButtonDblClk(nFlags, point);
}
//////测试:
// test1Dlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CTest1Dlg dialog
#include "mystatic.h"class CTest1Dlg : public CDialog
{
// Construction
public:
CTest1Dlg(CWnd* pParent = NULL); // standard constructor// Dialog Data
//{{AFX_DATA(CTest1Dlg)
enum { IDD = IDD_TEST1_DIALOG };
CMyStatic m_mystatic1;
//}}AFX_DATA // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTest1Dlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected:
HICON m_hIcon; // Generated message map functions
//{{AFX_MSG(CTest1Dlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};