定义了一个HDN_BEGINTRACK事件,发现拖动后会留下一条竖线,于是GOOGLE,一篇英文文章上提供了解
BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
LPNMHDR pNMHDR = (LPNMHDR)lParam;
//LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
CancelEdit(); //取消编辑状态
}
}
2、自定义控件的字体
SetFont参数的字体变量需是程序运行时候一直存在的变量,不可以是局部变量,否则不能更改自定义控件的字体格式。
如下面的例子是加载16×16的资源ID为IDI_ADD的图标
(HICON)::LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_ADD), IMAGE_ICON, 16, 16, LR_SHARED);
当CreateWindow了一个子窗口,包括使用CDialog::Create创建一个WS_CHILD风格的对话框,父窗口终
发送WM_LBUTTONDOWN消息模拟鼠标按下,不能使用SendMessage,而应使用PostMessage,原因暂无时间了解。
"UPDATE "##LOCALDB_TABLENAME" SET "##LOCALDB_FN_UPLOADFLAG "=1 WHERE "##LOCALDB_FN_FLUXNO"=?"
{
//CFE_AUTOCOLOR
cf.dwMask = CFM_BOLD|CFM_CHARSET|CFM_COLOR|CFM_FACE|CFM_ITALIC|/
CFM_SIZE|CFM_UNDERLINE|CFM_STRIKEOUT;
BOOL bIsItalic = lf.lfItalic ;
BOOL bIsBold = (lf.lfWeight > FW_BOLD);//? FW_NORMAL:FW_BOLD;
BOOL bIsUnderline = lf.lfUnderline ;
BOOL bIsStrickout = lf.lfStrikeOut ;
cf.dwEffects &= ~CFE_AUTOCOLOR;
if (bIsBold)
cf.dwEffects |= CFE_BOLD;
else
cf.dwEffects &= ~CFE_BOLD;
cf.dwEffects |= CFE_ITALIC;
else
cf.dwEffects &= ~CFE_ITALIC;
if (bIsUnderline)
cf.dwEffects |= CFE_UNDERLINE;
else
cf.dwEffects &= ~CFE_UNDERLINE;
cf.dwEffects |= CFM_STRIKEOUT;
else
cf.dwEffects &= ~CFM_STRIKEOUT;
//设置属性
cf.yHeight = -15 * lf.lfHeight;
cf.crTextColor = textcolor;//;//m_Font_Color;
cf.bCharSet = lf.lfCharSet ;
cf.bPitchAndFamily = lf.lfPitchAndFamily ;
sprintf(cf.szFaceName, lf.lfFaceName);
}
{
lf.lfClipPrecision =2;
lf.lfQuality = 1;
//粗体
if ((cf.dwEffects &CFE_BOLD )>0)
lf.lfWeight = 700;
else
lf.lfWeight = 400;
if ((cf.dwEffects &CFE_ITALIC)>0)
lf.lfItalic = 1;
else
lf.lfItalic = 0;
//下划线
if ((cf.dwEffects & CFE_UNDERLINE)>0)
lf.lfUnderline = 1;
else
lf.lfUnderline = 0;
if ((cf.dwEffects & CFE_STRIKEOUT)>0)
lf.lfStrikeOut = 1;
else
lf.lfStrikeOut =0;
lf.lfHeight = (-cf.yHeight/15);
textcolor = cf.crTextColor;
lf.lfCharSet = cf.bCharSet;
lf.lfPitchAndFamily = cf.bPitchAndFamily;
sprintf(lf.lfFaceName, cf.szFaceName);}