VC高手请进。VC中透明浮动按钮的问题!(急)
我从CButton 派生了一个类CDrawButton来实现对话框上的透明浮动按钮
class CDrawButton : public CButton
{
// Construction
public:
CDrawButton();
private:
CFont* m_pFont;
CBitmap* m_pBmp;
UINT mBtnStats;
public:
virtual ~CDrawButton();
void SetButtonMode(UINT action, UINT mode);
void Draw(CWnd *pParent);
BOOL Load(UINT nID, CWnd *pParent);
// Generated message map functions
protected:
//{{AFX_MSG(CDrawButton)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
其中: Load如下:
BOOL CDrawButton::Load(UINT nID, CWnd *pParent)
{
if (m_pBmp!=0)
return FALSE;
if (!SubclassDlgItem(nID, pParent))
return FALSE;
Draw(pParent);
return TRUE;
}
在对话框中添加了OnMouseMove函数来初始化
void CEgDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Button.Load(IDC_SET,this);
CDialog::OnMouseMove(nFlags, point);
}
上面的OnMouseMove只能初始化一个按钮,也就是说Load只能运行一次,
我的问题就是:我的对话框上的按钮有多个,怎样来初始化其它的按钮
class CDrawButton : public CButton
{
// Construction
public:
CDrawButton();
private:
CFont* m_pFont;
CBitmap* m_pBmp;
UINT mBtnStats;
public:
virtual ~CDrawButton();
void SetButtonMode(UINT action, UINT mode);
void Draw(CWnd *pParent);
BOOL Load(UINT nID, CWnd *pParent);
// Generated message map functions
protected:
//{{AFX_MSG(CDrawButton)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
其中: Load如下:
BOOL CDrawButton::Load(UINT nID, CWnd *pParent)
{
if (m_pBmp!=0)
return FALSE;
if (!SubclassDlgItem(nID, pParent))
return FALSE;
Draw(pParent);
return TRUE;
}
在对话框中添加了OnMouseMove函数来初始化
void CEgDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Button.Load(IDC_SET,this);
CDialog::OnMouseMove(nFlags, point);
}
上面的OnMouseMove只能初始化一个按钮,也就是说Load只能运行一次,
我的问题就是:我的对话框上的按钮有多个,怎样来初始化其它的按钮
...全文
相关推荐
Mysql Table Difference SQL
自动检测新旧库表的差异以及字段差异,生成create table和alter table的语句。方便升级项目时更新旧表。
MFC可拖动工具栏实现:停靠、浮动与菜单绑定详解
在图形用户界面(GUI)开发中,布局灵活性直接关系到用户体验,尤其是Windows桌面应用中常见的工具栏。传统的固定工具栏常因空间不足而饱受诟病,可拖动工具栏则通过停靠与浮动机制,让用户自由安排按钮位置。其底层原理基于MFC框架中的CControlBar类与DockControlBar、EnableDocking等核心API,配合CBRS_GRIPPER等样式即可实现拖动、吸附与悬浮。这项技术不仅提升了界面利用率,也广泛适用于工业控制、数据管理等多工具并存的场景。本文以Visual C++环境下的MFC窗体
Mysql-Table-Difference-SQL-master.zip
自动检测新旧库表的差异以及字段差异,生成create table和alter table的语句。方便升级项目时更新旧表。
在php和MySql中计算时间差的方法
在php中计算时间差有时候是件麻烦的事!不过只要你掌握了日期时间函数的用法那这些也就变的简单了。
读取Excel表中的数据与数据库中的比对
通过读取excel表中的信息,进行数据的比对。 列出比对不成的数据。。


