⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_17005.htm

📁 一些关于vc的问答
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<blockquote><p>
回复者:弱兔 回复日期:2002-10-07 14:43:02
<br>内容:我还是不明白,程序在运行中,都是动态的,怎么手动?怎么用classwazd?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:凯凯 回复日期:2002-10-07 16:45:52
<br>内容:先看书,把基本概念搞明白。<BR><BR>TO:Green_Pig<BR>是俺自己做的。如果你要这种革命图像,我倒是有不少。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Norton AntivVirus 回复日期:2002-10-07 17:18:36
<br>内容:To : KK<BR><BR>来几张,看看<BR><BR>mail给我吧,资料中有地址
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:黄飚 回复日期:2002-10-07 17:42:57
<br>内容:1.你从CButton派生一个类,然后在OnNotify里写上你的代码!<BR>CWnd::OnNotify<BR>virtual BOOL CWnd::OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult );<BR><BR>Return Value<BR><BR>An application returns nonzero if it processes this message; otherwise 0.<BR><BR>Parameters<BR><BR>wParam<BR><BR>Identifies the control that sends the message if the message is from a control. Otherwise, wParam is 0.<BR><BR>lParam<BR><BR>Pointer to a notification message (NMHDR) structure that contains the notification code and additional information. For some notification messages, this parameter points to a larger structure that has the NMHDR structure as its first member.<BR><BR>pResult<BR><BR>Pointer to an LRESULT variable in which to store the result code if the message is handled.<BR><BR>Remarks<BR><BR>The framework calls this member function to inform the parent window of a control that an event has occurred in the control or that the control requires some kind of information.<BR><BR>OnNotify processes the message map for control notification.<BR><BR>Override this member function in your derived class to handle the WM_NOTIFY message. An override will not process the message map unless the base class OnNotify is called.<BR><BR>For more information on the WM_NOTIFY message, see Technical Note 61 (TN061), ON_NOTIFY and WM_NOTIFY messages. You may also be interested the related topics described in TN060, The New Windows Common Controls, and TN062, Message Reflection for Windows Controls.<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:黄飚 回复日期:2002-10-08 08:46:02
<br>内容:// BasicButton.cpp : implementation file<BR>//<BR><BR>#include "stdafx.h"<BR>#include "BaseButton.h"<BR>#include "MouseRepeater.h"<BR><BR>#ifdef _DEBUG<BR>#define new DEBUG_NEW<BR>#undef THIS_FILE<BR>static char THIS_FILE[] = __FILE__;<BR>#endif<BR><BR>// disable warning for use if this-pointer in constructor<BR>#pragma warning(disable : 4355) <BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CBaseButton<BR><BR>CBaseButton::CBaseButton()<BR>: m_bMouseOnButton(false),<BR>&nbsp;&nbsp;m_pCallback(NULL),<BR>&nbsp;&nbsp;m_pCallbackParam(NULL)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// create mouse repeaters<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pLButtonRepeater = new CMouseRepeater(this, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, WM_LBUTTONDOWN);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pMButtonRepeater = new CMouseRepeater(this, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONREPEAT);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pRButtonRepeater = new CMouseRepeater(this, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK, WM_RBUTTONREPEAT);<BR>}<BR><BR>CBaseButton::~CBaseButton()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// delete the mouse repeaters<BR>&nbsp;&nbsp;&nbsp;&nbsp;delete m_pLButtonRepeater;<BR>&nbsp;&nbsp;&nbsp;&nbsp;delete m_pMButtonRepeater;<BR>&nbsp;&nbsp;&nbsp;&nbsp;delete m_pRButtonRepeater;<BR>}<BR><BR><BR>BEGIN_MESSAGE_MAP(CBaseButton, CButton)<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG_MAP(CBaseButton)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_MOUSEMOVE()<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG_MAP<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)<BR>END_MESSAGE_MAP()<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CBaseButton message handlers<BR><BR>BOOL CBaseButton::Create(LPCTSTR szCaption, DWORD dwStyle, CRect &rect, CWnd* pParentWnd, UINT nID)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;dwStyle |= BS_OWNERDRAW|WS_CHILD|WS_VISIBLE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;BOOL bRes = CButton::Create(szCaption, dwStyle, rect, pParentWnd, nID);<BR>&nbsp;&nbsp;&nbsp;&nbsp;ModifyStyleEx(0, WS_EX_TRANSPARENT);<BR>&nbsp;&nbsp;&nbsp;&nbsp;return bRes;<BR>}<BR><BR>void CBaseButton::SetCallbackFunction(CallbackFunction pCallbackFct, void* pCallbackParam)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pCallback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= pCallbackFct;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pCallbackParam = pCallbackParam;<BR>}<BR><BR>void CBaseButton::Notify(long nMessage, unsigned long wParam, long lParam)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(m_pCallback)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_pCallback(m_pCallbackParam, nMessage, wParam, lParam);<BR>}<BR><BR>COLORREF CBaseButton::GetCurrentTextColor()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// if disabled<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!IsWindowEnabled())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return m_colorMap.GetColor(CColorMap::TEXTDISABLED);<BR>&nbsp;&nbsp;&nbsp;&nbsp;// if highlighted<BR>&nbsp;&nbsp;&nbsp;&nbsp;else if(m_bMouseOnButton)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return m_colorMap.GetColor(CColorMap::TEXTHIGHLIGHTED);<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return m_colorMap.GetColor(CColorMap::TEXTNORMAL);<BR>}<BR><BR>long CBaseButton::GetTextAlignment(const CRect &textRect, const CString &sText, CDC* pDC)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// find the text alignment<BR>&nbsp;&nbsp;&nbsp;&nbsp;DWORD nStyle = GetStyle();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;long nAlignment;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(textRect.Width() &lt; pDC-&gt;GetTextExtent(sText).cx)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment = DT_WORDBREAK;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment = DT_SINGLELINE;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// horisontal alignment<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(BS_CENTER==(BS_CENTER & nStyle))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_CENTER;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else if(BS_LEFT & nStyle)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_LEFT;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else if(BS_RIGHT & nStyle)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_RIGHT;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_CENTER;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// vertical alignment<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(BS_VCENTER==(BS_VCENTER & nStyle))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_VCENTER;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else if(BS_TOP & nStyle)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_TOP;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else if(BS_BOTTOM & nStyle)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_BOTTOM;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nAlignment |= DT_VCENTER;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return nAlignment;<BR>}<BR><BR>LRESULT CBaseButton::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pLButtonRepeater-&gt;OnMessage(message, wParam, lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pMButtonRepeater-&gt;OnMessage(message, wParam, lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pRButtonRepeater-&gt;OnMessage(message, wParam, lParam);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;switch(message)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_LBUTTONDOWN:<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_LBUTTONUP:<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_MBUTTONDOWN:<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_MBUTTONUP:<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_MBUTTONREPEAT:&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_RBUTTONDOWN:<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_RBUTTONUP:<BR>&nbsp;&nbsp;&nbsp;&nbsp;case WM_RBUTTONREPEAT:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Notify(message, GetDlgCtrlID(), 0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return CButton::WindowProc(message, wParam, lParam);<BR>}<BR><BR>void CBaseButton::OnMouseMove(UINT nFlags, CPoint point) <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!m_bMouseOnButton){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TRACKMOUSEEVENT tme;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tme.cbSize&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= sizeof(tme);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tme.dwFlags&nbsp;&nbsp;&nbsp;&nbsp; = TME_LEAVE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tme.hwndTrack&nbsp;&nbsp; = m_hWnd;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tme.dwHoverTime = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_TrackMouseEvent(&tme);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_bMouseOnButton = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetFocus();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Invalidate(false);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;CButton::OnMouseMove(nFlags, point);<BR>}<BR><BR>long CBaseButton::OnMouseLeave(UINT /*wParam*/, LONG /*lParam*/)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_bMouseOnButton = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Invalidate(false);<BR>&nbsp;&nbsp;&nbsp;&nbsp;return true;<BR>}<BR><BR>void CBaseButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CDC *pDC = CDC::FromHandle(lpDrawItemStruct-&gt;hDC);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// background<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CBrush&nbsp;&nbsp; brush(m_colorMap.GetColor(CColorMap::BACKGROUND));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pDC-&gt;FillRect(&lpDrawItemStruct-&gt;rcItem, &brush);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(m_bMouseOnButton && ODS_DISABLED != lpDrawItemStruct-&gt;itemState)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if((ODS_SELECTED | ODS_CHECKED) & lpDrawItemStruct-&gt;itemState)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pDC-&gt;Draw3dRect(&lpDrawItemStruct-&gt;rcItem,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_colorMap.GetColor(CColorMap::EDGE2),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_colorMap.GetColor(CColorMap::EDGE1));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pDC-&gt;Draw3dRect(&lpDrawItemStruct-&gt;rcItem,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_colorMap.GetColor(CColorMap::EDGE1),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_colorMap.GetColor(CColorMap::EDGE2));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// text <BR>&nbsp;&nbsp;&nbsp;&nbsp;DrawText(pDC, &lpDrawItemStruct-&gt;rcItem);<BR>}<BR><BR>void CBaseButton::DrawText(CDC* pDC, LPRECT pRect)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;pDC-&gt;SetTextColor(GetCurrentTextColor());<BR>&nbsp;&nbsp;&nbsp;&nbsp;pDC-&gt;SetBkMode(TRANSPARENT);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;CString sText;<BR>&nbsp;&nbsp;&nbsp;&nbsp;GetWindowText(sText);<BR>&nbsp;&nbsp;&nbsp;&nbsp;CRect textRect(pRect);<BR>&nbsp;&nbsp;&nbsp;&nbsp;textRect.DeflateRect(2,2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pDC-&gt;DrawText(sText, &textRect, GetTextAlignment(textRect, sText, pDC));<BR>}<BR><BR>void CBaseButton::PreSubclassWindow() <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;ModifyStyle(0, BS_OWNERDRAW);&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// set the default font<BR>&nbsp;&nbsp;&nbsp;&nbsp;SetFont(GetDefaultFont());<BR>&nbsp;&nbsp;&nbsp;&nbsp;CButton::PreSubclassWindow();<BR>}<BR>#if !defined(AFX_BASICBUTTON_H__F4311646_514F_4386_99E5_B9394FB3AAB4__INCLUDED_)<BR>#define AFX_BASICBUTTON_H__F4311646_514F_4386_99E5_B9394FB3AAB4__INCLUDED_<BR><BR>#if _MSC_VER &gt; 1000<BR>#pragma once<BR>#endif // _MSC_VER &gt; 1000<BR>// BasicButton.h : header file<BR>//<BR><BR>#include "UserInterfaceControlsXIPORT.h"<BR>#include "ColorMap.h"<BR><BR>typedef void(*CallbackFunction)(void* pOwner, long nMessage, unsigned long wParam, long lParam);<BR>class CMouseRepeater;<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CBaseButton window<BR><BR>class _UICONTROLS_API_ CBaseButton : public CButton<BR>{<BR>public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// class constructor<BR>&nbsp;&nbsp;&nbsp;&nbsp;CBaseButton();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// class destructor<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual ~CBaseButton();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Create<BR>&nbsp;&nbsp;&nbsp;&nbsp;// <BR>&nbsp;&nbsp;&nbsp;&nbsp;// Description:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Creates the button as a child window on 'pParentWnd'. <BR>&nbsp;&nbsp;&nbsp;&nbsp;// Remember to call DestroyWindow when removing button<BR>&nbsp;&nbsp;&nbsp;&nbsp;BOOL Create(LPCTSTR szCaption /* caption */,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWORD dwStyle /* button style (std Win32) */,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CRect &rect /* button position */,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CWnd* pParentWnd /* parent window */,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UINT nID /* control ID */);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Set Callback function<BR>&nbsp;&nbsp;&nbsp;&nbsp;// <BR>&nbsp;&nbsp;&nbsp;&nbsp;// Description:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Sets the call back function and call back parameter<BR>&nbsp;&nbsp;&nbsp;&nbsp;void SetCallbackFunction(CallbackFunction, void* pCallbackParam);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// object containing colors for the button<BR>&nbsp;&nbsp;&nbsp;&nbsp;CColorMap m_colorMap;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Overrides<BR>&nbsp;&nbsp;&nbsp;&nbsp;// ClassWizard generated virtual function overrides<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_VIRTUAL(CBaseButton)<BR>&nbsp;&nbsp;&nbsp;&nbsp;public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);<BR>&nbsp;&nbsp;&nbsp;&nbsp;protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void PreSubclassWindow();<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_VIRTUAL<BR><BR>protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// mouse button repeater for L-button<BR>&nbsp;&nbsp;&nbsp;&nbsp;CMouseRepeater* m_pLButtonRepeater;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// mouse button repeater for M-button<BR>&nbsp;&nbsp;&nbsp;&nbsp;CMouseRepeater* m_pMButtonRepeater;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// mouse button repeater for R-button<BR>&nbsp;&nbsp;&nbsp;&nbsp;CMouseRepeater* m_pRButtonRepeater;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// pointer to owner call back notification function<BR>&nbsp;&nbsp;&nbsp;&nbsp;CallbackFunction m_pCallback;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;// pointer to use in callback function<BR>&nbsp;&nbsp;&nbsp;&nbsp;void* m_pCallbackParam;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// flag indicating if mouse is on the button<BR>&nbsp;&nbsp;&nbsp;&nbsp;bool m_bMouseOnButton;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Notify<BR>&nbsp;&nbsp;&nbsp;&nbsp;// <BR>&nbsp;&nbsp;&nbsp;&nbsp;// Description:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Sends a notification message to the callback function if set.<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Use CBaseButton::SetCallbackFunction to set the function pointer.<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void Notify(long nMessage, unsigned long wParam, long lParam);<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Get Current Text Color<BR>&nbsp;&nbsp;&nbsp;&nbsp;// <BR>&nbsp;&nbsp;&nbsp;&nbsp;// Output:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Returns the RGB reference of the current text color<BR>&nbsp;&nbsp;&nbsp;&nbsp;COLORREF GetCurrentTextColor();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Get Text Alignment<BR>&nbsp;&nbsp;&nbsp;&nbsp;// <BR>&nbsp;&nbsp;&nbsp;&nbsp;// Output:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Returns the text alignment on the button (alignment for CDC::DrawText)<BR>&nbsp;&nbsp;&nbsp;&nbsp;long GetTextAlignment(const CRect &textRect /* text area */, const CString &sText /* text */, CDC* pDC /* drawing device */);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// DrawText<BR>&nbsp;&nbsp;&nbsp;&nbsp;// <BR>&nbsp;&nbsp;&nbsp;&nbsp;// Description:<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Draws the caption text<BR>&nbsp;&nbsp;&nbsp;&nbsp;void DrawText(CDC* pDC /*device context*/, LPRECT pRect /*button rect*/);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG(CBaseButton)<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg void OnMouseMove(UINT nFlags, CPoint point);<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG<BR>&nbsp;&nbsp;&nbsp;&nbsp;// WM_MOUSELEAVE handler<BR>&nbsp;&nbsp;&nbsp;&nbsp;afx_msg long OnMouseLeave(UINT wParam, LONG lParam);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;DECLARE_MESSAGE_MAP()<BR>};<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR><BR>//{{AFX_INSERT_LOCATION}}<BR>// Microsoft Visual C++ will insert additional declarations immediately before the previous line.<BR><BR>#endif // !defined(AFX_BASICBUTTON_H__F4311646_514F_4386_99E5_B9394FB3AAB4__INCLUDED_)<BR>你参考一下,能不能给点分鼓励一下,谢谢<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -