本文整理汇总了C++中CButton::SetFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::SetFocus方法的具体用法?C++ CButton::SetFocus怎么用?C++ CButton::SetFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::SetFocus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PreTranslateMessage
BOOL CFreeCoolDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN )
{
if(pMsg->wParam == VK_RETURN )
{
CButton * pbutton = (CButton *)GetDlgItem(IDCANCEL);
pbutton->SetFocus();
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
示例2: onInitDialog
//.........这里部分代码省略.........
m_ctrlToolTip.Create(EmoticonsDlg::m_hWnd, rcDefault, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | TTS_BALLOON, WS_EX_TOPMOST);
m_ctrlToolTip.SetDelayTime(TTDT_AUTOMATIC, 1000);
pos.left = 0;
pos.right = iSW + EMOTICONS_ICONMARGIN;
pos.top = 0;
pos.bottom = iSH + EMOTICONS_ICONMARGIN;
cleanHandleList();
auto l_Emotion = Emoticons.begin();
for (unsigned int iY = 0; iY < nYfor; iY++)
for (unsigned int iX = 0; iX < nXfor; iX++)
{
if (l_Emotion != Emoticons.end()) // TODO - merge
{
const auto i = *l_Emotion;
if ((iY * nXfor) + iX + 1 > l_Emoticons_size) break;
bool bNotDuplicated = (bUseAnimation ?
(i->getEmotionBmpPath() != lastEmotionPath ||
i->getEmotionGifPath() != lastAnimEmotionPath) :
i->getEmotionBmpPath() != lastEmotionPath);
// dve stejne emotikony za sebou nechceme
if (bNotDuplicated)
{
bool bCreated = false;
CGDIImage *pImage = nullptr;
if (bUseAnimation)
pImage = i->getAnimatedImage(MainFrame::getMainFrame()->m_hWnd, WM_ANIM_CHANGE_FRAME);
if (pImage)
{
const tstring smajl = i->getEmotionText();
CAnimatedButton *pemoButton = new CAnimatedButton(pImage);
m_BtnList.push_back(pemoButton);
pemoButton->Create(EmoticonsDlg::m_hWnd, pos, smajl.c_str(), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | BS_FLAT | BS_BITMAP, WS_EX_TRANSPARENT);
m_ctrlToolTip.AddTool(*pemoButton, smajl.c_str());
bCreated = true;
}
else
{
if (const HBITMAP l_h_bm = i->getEmotionBmp(GetSysColor(COLOR_BTNFACE)))
{
CButton emoButton;
const tstring smajl = i->getEmotionText();
emoButton.Create(EmoticonsDlg::m_hWnd, pos, smajl.c_str(), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | BS_FLAT | BS_BITMAP | BS_CENTER);
m_HandleList.push_back(l_h_bm);
emoButton.SetBitmap(l_h_bm);
m_ctrlToolTip.AddTool(emoButton, smajl.c_str());
DeleteObject((HGDIOBJ)emoButton);
bCreated = true;
}
}
if (bCreated)
{
// Calculate position of next button
pos.left = pos.left + iSW + EMOTICONS_ICONMARGIN;
pos.right = pos.left + iSW + EMOTICONS_ICONMARGIN;
if (pos.left >= (LONG)(nX * (iSW + EMOTICONS_ICONMARGIN)))
{
pos.left = 0;
pos.right = iSW + EMOTICONS_ICONMARGIN;
pos.top = pos.top + iSH + EMOTICONS_ICONMARGIN;
pos.bottom = pos.top + iSH + EMOTICONS_ICONMARGIN;
}
}
}
lastEmotionPath = i->getEmotionBmpPath();
if (bUseAnimation)
lastAnimEmotionPath = i->getEmotionGifPath();
++l_Emotion;
}
}
pos.left = -128;
pos.right = pos.left;
pos.top = -128;
pos.bottom = pos.top;
CButton emoButton;
emoButton.Create(EmoticonsDlg::m_hWnd, pos, _T(""), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | BS_FLAT);
emoButton.SetFocus();
DeleteObject((HGDIOBJ)emoButton);
ShowWindow(SW_SHOW);
for (auto i = m_BtnList.cbegin(); i != m_BtnList.cend(); ++i)
{
(*i)->Update();
}
}
else PostMessage(WM_CLOSE);
return 0;
}