// XpButtonExCtl.cpp : Implementation of the CXpButtonExCtrl ActiveX Control class.
#include "stdafx.h"
#include "xpButtonEx.h"
#include "XpButtonExCtl.h"
#include "XpButtonExPpg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CXpButtonExCtrl, COleControl)
/////////////////////////////////////////////////////////////////////////////
// Message map
BEGIN_MESSAGE_MAP(CXpButtonExCtrl, COleControl)
//{{AFX_MSG_MAP(CXpButtonExCtrl)
ON_WM_CREATE()
ON_WM_ERASEBKGND()
ON_WM_KEYDOWN()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
ON_MESSAGE(OCM_COMMAND, OnOcmCommand)
ON_MESSAGE(OCM_DRAWITEM, OnOcmDrawItem)
ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)
ON_OLEVERB(AFX_IDS_VERB_EDIT, OnEdit)
ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Dispatch map
BEGIN_DISPATCH_MAP(CXpButtonExCtrl, COleControl)
//{{AFX_DISPATCH_MAP(CXpButtonExCtrl)
DISP_PROPERTY_NOTIFY(CXpButtonExCtrl, "title", m_title, OnTitleChanged, VT_BSTR)
DISP_STOCKPROP_FONT()
//}}AFX_DISPATCH_MAP
DISP_FUNCTION_ID(CXpButtonExCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()
/////////////////////////////////////////////////////////////////////////////
// Event map
BEGIN_EVENT_MAP(CXpButtonExCtrl, COleControl)
//{{AFX_EVENT_MAP(CXpButtonExCtrl)
EVENT_STOCK_CLICK()
//}}AFX_EVENT_MAP
END_EVENT_MAP()
/////////////////////////////////////////////////////////////////////////////
// Property pages
// TODO: Add more property pages as needed. Remember to increase the count!
BEGIN_PROPPAGEIDS(CXpButtonExCtrl, 2)
PROPPAGEID(CXpButtonExPropPage::guid)
PROPPAGEID(CLSID_CFontPropPage)
END_PROPPAGEIDS(CXpButtonExCtrl)
/////////////////////////////////////////////////////////////////////////////
// Initialize class factory and guid
IMPLEMENT_OLECREATE_EX(CXpButtonExCtrl, "XPBUTTONEX.XpButtonExCtrl.1",
0xa4545e47, 0x89ca, 0x11d6, 0xaf, 0x8d, 0, 0x3, 0x47, 0x88, 0x98, 0x58)
/////////////////////////////////////////////////////////////////////////////
// Type library ID and version
IMPLEMENT_OLETYPELIB(CXpButtonExCtrl, _tlid, _wVerMajor, _wVerMinor)
/////////////////////////////////////////////////////////////////////////////
// Interface IDs
const IID BASED_CODE IID_DXpButtonEx =
{ 0xa4545e45, 0x89ca, 0x11d6, { 0xaf, 0x8d, 0, 0x3, 0x47, 0x88, 0x98, 0x58 } };
const IID BASED_CODE IID_DXpButtonExEvents =
{ 0xa4545e46, 0x89ca, 0x11d6, { 0xaf, 0x8d, 0, 0x3, 0x47, 0x88, 0x98, 0x58 } };
/////////////////////////////////////////////////////////////////////////////
// Control type information
static const DWORD BASED_CODE _dwXpButtonExOleMisc =
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST |
OLEMISC_INSIDEOUT |
OLEMISC_CANTLINKINSIDE |
OLEMISC_RECOMPOSEONRESIZE;
IMPLEMENT_OLECTLTYPE(CXpButtonExCtrl, IDS_XPBUTTONEX, _dwXpButtonExOleMisc)
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::CXpButtonExCtrlFactory::UpdateRegistry -
// Adds or removes system registry entries for CXpButtonExCtrl
BOOL CXpButtonExCtrl::CXpButtonExCtrlFactory::UpdateRegistry(BOOL bRegister)
{
// TODO: Verify that your control follows apartment-model threading rules.
// Refer to MFC TechNote 64 for more information.
// If your control does not conform to the apartment-model rules, then
// you must modify the code below, changing the 6th parameter from
// afxRegInsertable | afxRegApartmentThreading to afxRegInsertable.
if (bRegister)
return AfxOleRegisterControlClass(
AfxGetInstanceHandle(),
m_clsid,
m_lpszProgID,
IDS_XPBUTTONEX,
IDB_XPBUTTONEX,
afxRegInsertable | afxRegApartmentThreading,
_dwXpButtonExOleMisc,
_tlid,
_wVerMajor,
_wVerMinor);
else
return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::CXpButtonExCtrl - Constructor
CXpButtonExCtrl::CXpButtonExCtrl()
{
InitializeIIDs(&IID_DXpButtonEx, &IID_DXpButtonExEvents);
// TODO: Initialize your control's instance data here.
m_bOverControl = FALSE;
pBoundryPen = new CPen(PS_INSIDEFRAME|PS_SOLID,1,RGB(0,0,0));
pInsideBoundryPenLeft = new CPen(PS_INSIDEFRAME|PS_SOLID,3,RGB(250,196,88));
pInsideBoundryPenRight = new CPen(PS_INSIDEFRAME|PS_SOLID,3,RGB(251,202,106));
pInsideBoundryPenTop = new CPen(PS_INSIDEFRAME|PS_SOLID,2,RGB(252,210,121));
pInsideBoundryPenBottom = new CPen(PS_INSIDEFRAME|PS_SOLID,2,RGB(229,151,0));
pFillActive = new CBrush(RGB(222,223,236));
pFillInactive = new CBrush(RGB(222,223,236));
//strCaption = "Caption";
//m_title = "caption";
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::~CXpButtonExCtrl - Destructor
CXpButtonExCtrl::~CXpButtonExCtrl()
{
// TODO: Cleanup your control's instance data here.
pBoundryPen->DeleteObject();
pFillActive->DeleteObject();
pFillInactive->DeleteObject();
pOldPen->DeleteObject();
pOldBrush->DeleteObject();
pInsideBoundryPenLeft->DeleteObject();
pInsideBoundryPenRight->DeleteObject();
pInsideBoundryPenBottom->DeleteObject();
pInsideBoundryPenTop->DeleteObject();
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::OnDraw - Drawing function
void CXpButtonExCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
DoSuperclassPaint(pdc, rcBounds);
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::DoPropExchange - Persistence support
void CXpButtonExCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);
// TODO: Call PX_ functions for each persistent custom property.
PX_String( pPX, _T("title"), m_title, _T("Caption"));
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::OnResetState - Reset control to default state
void CXpButtonExCtrl::OnResetState()
{
COleControl::OnResetState(); // Resets defaults found in DoPropExchange
// TODO: Reset any other control state here.
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::AboutBox - Display an "About" box to the user
void CXpButtonExCtrl::AboutBox()
{
CDialog dlgAbout(IDD_ABOUTBOX_XPBUTTONEX);
dlgAbout.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::PreCreateWindow - Modify parameters for CreateWindowEx
BOOL CXpButtonExCtrl::PreCreateWindow(CREATESTRUCT& cs)
{
cs.lpszClass = _T("BUTTON");
return COleControl::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::IsSubclassedControl - This is a subclassed control
BOOL CXpButtonExCtrl::IsSubclassedControl()
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl::OnOcmCommand - Handle command messages
LRESULT CXpButtonExCtrl::OnOcmCommand(WPARAM wParam, LPARAM lParam)
{
#ifdef _WIN32
WORD wNotifyCode = HIWORD(wParam);
#else
WORD wNotifyCode = HIWORD(lParam);
#endif
// TODO: Switch on wNotifyCode here.
switch (wNotifyCode)
{
case BN_CLICKED:
// Fire click event when button is clicked
//FireClick();
break;
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CXpButtonExCtrl message handlers
int CXpButtonExCtrl::OnCreate(LPCREATE
xpButton_src.zip_style
版权申诉
12 浏览量
2022-09-24
12:59:32
上传
评论
收藏 6KB ZIP 举报
朱moyimi
- 粉丝: 61
- 资源: 1万+
最新资源
- 农村信用社联合社计算机信息系统投产与变更管理办.docx
- 农村信用社联合社计算机信息系统数据管理办法.docx
- 利用SPSS作临床效度分析线上计算网站介绍-医学研究部统计谘.(医学PPT课件).ppt
- 利用Zabbix监控mysqldump定时备份数据库状态.docx
- 利用计算机解决问题的基本过程.doc
- 化工铁路通信工程总结.doc
- 北京大学网络教育软件工程作业.docx
- 医药公司(连锁店)计算机操作规程未新系统的自行按照旧制修改-新系统过制的编号加修模版.doc
- 医药公司(连锁店)计算机系统操作规程模版.doc
- 医药连锁门店计算机系统的操作和管理程序未新系统的自行按照旧制修改-新系统过制的编号加修模版.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈