16,472
社区成员
发帖
与我相关
我的任务
分享
xui_logComboBox xLogCb=CResKeeper::m_logComboBox;//此处出现caerror C2440: 错误
xui_logComboBox xLogCbA, xLogCbB;
xLogCbA = xLogCbB;//此处无此错误
////////////////////////////////////////////////////////////
//.h
static xui_logComboBox m_logComboBox;
//.cpp
xui_logComboBox CResKeeper::m_logComboBox;
//define 实现 = 操作符
struct xui_logComboBox
{
enum xField
{
CB_EDIT = 1 << 1,
CB_BTN = 1 << 2,
CB_ITEMBACK = 1 << 3,
CB_LISTITEM = 1 << 4,
};
struct cbEdit
{
LOGFONT logFont;
COLORREF clrText;
COLORREF clrTL;
COLORREF clrRB;
int nBdWidth;
cbEdit & operator = ( cbEdit & src)
{
logFont = src.logFont;
clrText = src.clrText;
clrTL = src.clrTL;
clrRB = src.clrRB;
nBdWidth = src.nBdWidth;
return *this;
}
};
struct cbBtn
{
enum xField
{
CBB_FILL = 1 << 1,
CBB_PIC = 1 << 2,
};
UINT nMask;
COLORREF clrTL;
COLORREF clrRB;
COLORREF clrBg;
BOOL bLR;
SIZE btnSize;
CString strPicture;
cbBtn & operator = ( cbBtn & src)
{
nMask = src.nMask;
clrTL = src.clrTL;
clrRB = src.clrRB;
clrBg = src.clrBg;
bLR = src.bLR;
btnSize = btnSize;
strPicture = src.strPicture;
return *this;
}
};
struct cbItemPaint
{
COLORREF clrBg;
CString picBg;
UINT nHeight;
LOGFONT logFontText;
COLORREF clrText;
UINT nFormatText;
cbItemPaint & operator = ( cbItemPaint & src)
{
clrBg = src.clrBg;
picBg = src.picBg;
nHeight = src.nHeight;
logFontText = src.logFontText;
clrText = src.clrText;
nFormatText = src.nFormatText;
return *this;
}
};
struct xui_cbItemContent
{
enum xField
{
CBIC_TEXT = 1 << 1,
CBIC_PIC = 1 << 2,
CBIC_DATA = 1 << 3,
};
UINT nMask;
CString strText;
CString strPicture;
int nItemData;
xui_cbItemContent & operator = ( xui_cbItemContent & src)
{
nMask = src.nMask;
strText = src.strText;
strPicture = src.strPicture;
nItemData = src.nItemData;
return *this;
}
};
UINT nMask;
cbEdit cbEditItem;
cbBtn cbBtnNormal, cbBtnSel;
cbItemPaint cbItemBgNormal, cbItemBgSel;
CList< xui_cbItemContent, xui_cbItemContent&> listItem;
xui_logComboBox & operator = ( xui_logComboBox & src)
{
nMask = src.nMask;
cbEditItem = src.cbEditItem;
cbBtnNormal = src.cbBtnNormal;
cbBtnSel = src.cbBtnSel;
cbItemBgNormal = src.cbItemBgNormal;
cbItemBgSel = src.cbItemBgSel;
POSITION posItem = NULL;
posItem = src.listItem.GetHeadPosition();
while( posItem)
{
listItem.AddTail( src.listItem.GetAt( posItem));
///
src.listItem.GetNext( posItem);
}
return * this;
}
};