本文整理汇总了C++中CButton类的典型用法代码示例。如果您正苦于以下问题:C++ CButton类的具体用法?C++ CButton怎么用?C++ CButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssertBotE
afx_msg void CChooseRacePage::OnChooseRace(UINT nID)
{
using namespace network;
// IDs der Buttons
unsigned ids[] = {IDC_RACE, IDC_RACE2, IDC_RACE3, IDC_RACE4, IDC_RACE5, IDC_RACE6};
for (int i = 0; i < RACE_COUNT; i++)
{
AssertBotE(i < 6);
CButton *pButton = (CButton *)GetDlgItem(ids[i]);
AssertBotE(pButton);
if (ids[i] == nID)
{
if (pButton->GetCheck())
{
pButton->SetCheck(FALSE);
m_pParent->GetDlgItem(ID_WIZBACK)->SetFocus();
client.RequestRace(network::RACE_NONE);
}
else
{
pButton->SetCheck(TRUE);
client.RequestRace((network::RACE)(network::RACE_FIRST + i));
// Soundwiedergabe für die Rasse
switch (i + 1)
{
case network::RACE_1: CSoundManager::GetInstance()->PlaySound(SNDMGR_VOICE_FED_RACESELECT); break;
case network::RACE_2: CSoundManager::GetInstance()->PlaySound(SNDMGR_VOICE_FER_RACESELECT); break;
case network::RACE_3: CSoundManager::GetInstance()->PlaySound(SNDMGR_VOICE_KLI_RACESELECT); break;
case network::RACE_4: CSoundManager::GetInstance()->PlaySound(SNDMGR_VOICE_ROM_RACESELECT); break;
case network::RACE_5: CSoundManager::GetInstance()->PlaySound(SNDMGR_VOICE_CAR_RACESELECT); break;
case network::RACE_6: CSoundManager::GetInstance()->PlaySound(SNDMGR_VOICE_DOM_RACESELECT); break;
}
}
}
else
pButton->SetCheck(FALSE);
}
}
示例2: CGridPageViewCell
Ref* Recomebineui::adapt_gpv_bag(Ref* pConvertCell, unsigned int uIdx)
{
CGridPageViewCell* pCell = (CGridPageViewCell*)pConvertCell;
CButton *btn = nullptr;
if (!pCell)
{
pCell = new CGridPageViewCell();
pCell->autorelease();
TuiManager::getInstance()->parseCell(pCell, "cell_grid", PATH_RECOMBINEUI);
btn = (CButton*)pCell->getChildByTag(BTN_GRID);
btn->setOnClickListener(this, ccw_click_selector(Recomebineui::event_btn_click));
}
else{
btn = (CButton*)pCell->getChildByTag(BTN_GRID);
}
btn->setUserTag(uIdx);
return pCell;
}
示例3: setTitle
bool CCheckBoxExclusionTest::init()
{
CCheckBoxTestSceneBase::init();
setTitle("CCheckBoxExclusionTest");
setDescription("checkbox exclusion test");
CREATE_CHECKBOX(pCheckBox1, CCPoint(480, 490));
pCheckBox1->setTag(1);
pCheckBox1->setExclusion(1);
pCheckBox1->setChecked(true);
pCheckBox1->setEnabled(false);
m_pWindow->addChild(pCheckBox1);
CREATE_CHECKBOX(pCheckBox2, CCPoint(480, 425));
pCheckBox2->setExclusion(1);
m_pWindow->addChild(pCheckBox2);
CREATE_CHECKBOX(pCheckBox3, CCPoint(480, 360));
pCheckBox3->setExclusion(1);
m_pWindow->addChild(pCheckBox3);
CREATE_CHECKBOX(pCheckBox4, CCPoint(480, 295));
pCheckBox4->setExclusion(1);
m_pWindow->addChild(pCheckBox4);
CREATE_CHECKBOX(pCheckBox5, CCPoint(480, 230));
pCheckBox5->setExclusion(1);
m_pWindow->addChild(pCheckBox5);
CREATE_CHECKBOX(pCheckBox6, CCPoint(480, 165));
pCheckBox6->setExclusion(1);
m_pWindow->addChild(pCheckBox6);
CButton* pButton = CButton::createWith9Sprite(CCSize(280, 60),
"sprite9_btn1.png", "sprite9_btn2.png");
pButton->setPosition(CCPoint(200, 450));
pButton->setUserTag(1);
pButton->setOnClickListener(this, ccw_click_selector(CCheckBoxExclusionTest::onClick));
pButton->initText("set true for first", "", 30);
m_pWindow->addChild(pButton);
return true;
}
示例4: dc
void CLightDlg::ColorButtons() {
CRect r;
CClientDC dc(this);
CButton *pBtn = (CButton *)GetDlgItem(IDC_BTN_COLOR);
pBtn->GetClientRect(&r);
colorBitmap.DeleteObject();
colorBitmap.CreateCompatibleBitmap(&dc, r.Width(), r.Height());
CDC MemDC;
MemDC.CreateCompatibleDC(&dc);
CBitmap *pOldBmp = MemDC.SelectObject(&colorBitmap);
{
CBrush br(RGB(color[0], color[1], color[2]));
MemDC.FillRect(r,&br);
}
dc.SelectObject(pOldBmp);
pBtn->SetBitmap(HBITMAP(colorBitmap));
}
示例5: CRect
void CGestionMineralesDlg::NuevoGrupoControles(int nIndice)
{
const unsigned __int8 nFilasMax = 20;
const unsigned __int8 nTamCheck = 15;
const unsigned __int8 nEspaciado = 25;
const unsigned __int8 nDistanciaColumnas = 200;
const unsigned __int8 nSangriaInicial = 40;
const unsigned __int8 nTamBotones = 15;
const unsigned __int8 nEspaciadoBotones = 25;
// lista para enlazar los indices iniciales con los reales de los vectores
//m_vecMap.push_back(nIndice);
unsigned int fila, columna;
CButton* pButton;
CString csInfo;
HBITMAP hBitmapEditar= (HBITMAP) m_bitmapEditar.GetSafeHandle();
HBITMAP hBitmapBorrar= (HBITMAP) m_bitmapBorrar.GetSafeHandle();
fila = nIndice % nFilasMax;
columna = nIndice / nFilasMax;
csInfo.Format("%-4s - %s",theApp.m_minerales.GetAbreviatura(nIndice), theApp.m_minerales.GetNombre(nIndice));
// Delete
pButton = new CButton;
pButton->Create("x",WS_CHILD | WS_VISIBLE |BS_BITMAP/*| BS_LEFTTEXT*/,
CRect(nSangriaInicial + columna*(nDistanciaColumnas+nEspaciadoBotones*2),
m_rect.bottom + nEspaciado*fila,
nSangriaInicial + columna*(nDistanciaColumnas+nEspaciadoBotones*2) + nTamBotones,
m_rect.bottom + nEspaciado*fila + nTamBotones ), this, CONTROLES_DINAMICOS_MIN + nIndice*3 +2);
pButton->SetBitmap(hBitmapBorrar);
m_vecDelete.push_back(pButton);
//Edit
pButton = new CButton;
pButton->Create("e",WS_CHILD | WS_VISIBLE |BS_BITMAP /*| BS_LEFTTEXT*/,
CRect(nSangriaInicial + columna*(nDistanciaColumnas+nEspaciadoBotones*2)+ nEspaciadoBotones,
m_rect.bottom + nEspaciado*fila,
nSangriaInicial + columna*(nDistanciaColumnas+nEspaciadoBotones*2)+ nEspaciadoBotones + nTamBotones,
m_rect.bottom + nTamBotones + nEspaciado*fila), this, CONTROLES_DINAMICOS_MIN + nIndice*3 +1);
pButton->SetBitmap(hBitmapEditar);
m_vecEdit.push_back(pButton);
//Check
pButton = new CButton;
pButton->Create(csInfo,WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX /*| BS_LEFTTEXT*/,
CRect(nSangriaInicial + columna*(nDistanciaColumnas+nEspaciadoBotones*2)+ nEspaciadoBotones*2,
m_rect.bottom + nEspaciado*fila,
nSangriaInicial + columna*(nDistanciaColumnas+nEspaciadoBotones*2)+ nEspaciadoBotones*2 + nDistanciaColumnas,
m_rect.bottom + nTamCheck + nEspaciado*fila), this, CONTROLES_DINAMICOS_MIN + nIndice*3);
pButton->SetCheck(theApp.m_minerales.m_list[nIndice]->m_bActivo);
m_vecCheck.push_back(pButton);
this->SetWindowPos(NULL,0,0,max(nSangriaInicial + columna*(nDistanciaColumnas+nEspaciadoBotones*2)+ nEspaciadoBotones*2 + nDistanciaColumnas + 50, m_rect.right),
m_rect.bottom + nTamCheck + nEspaciado*nFilasMax + 50, SWP_NOMOVE | SWP_NOZORDER); //+50 para el menu y barra de titulo
}
示例6: GetPageControls
bool CPatchUndoTest::DoPageEdit(CWnd *pParent, CString& PageName, CString& CtrlCaption)
{
CHWNDArray Ctrl;
CTabbedDlg *pTabDlg = GetPageControls(pParent, PageName, Ctrl);
ASSERT(pTabDlg != NULL);
ASSERT(Ctrl.GetSize());
int iCtrl = Random(Ctrl.GetSize());
CWnd *pWnd = CWnd::FromHandle(Ctrl[iCtrl]);
if (pWnd == NULL || !pWnd->IsWindowEnabled()) // skip disabled controls
return(FALSE);
UINT nID = pWnd->GetDlgCtrlID();
CtrlCaption = pTabDlg->GetControlCaption(nID);
CNumEdit *pNumEdit = DYNAMIC_DOWNCAST(CNumEdit, pWnd);
if (pNumEdit != NULL) {
double val = pNumEdit->GetVal();
pNumEdit->AddSpin(1);
if (pNumEdit->GetVal() == val)
pNumEdit->AddSpin(-1);
return(TRUE);
}
CComboBox *pCombo = DYNAMIC_DOWNCAST(CComboBox, pWnd);
if (pCombo != NULL) {
int nItems = pCombo->GetCount();
if (nID == IDC_PATCH_GEN_PPQ) // if PPQ combo
nItems /= 4; // limit range to avoid zero timer period
int iItem = RandomExcluding(nItems, pCombo->GetCurSel());
if (iItem < 0)
return(FALSE);
pCombo->SetCurSel(iItem);
pCombo->GetParent()->SendMessage(WM_COMMAND,
MAKELONG(pCombo->GetDlgCtrlID(), CBN_SELCHANGE));
return(TRUE);
}
CButton *pBtn = DYNAMIC_DOWNCAST(CButton, pWnd);
if (pBtn != NULL) {
pBtn->SetCheck(!pBtn->GetCheck());
pBtn->GetParent()->SendMessage(WM_COMMAND,
MAKELONG(pBtn->GetDlgCtrlID(), BN_CLICKED));
return(TRUE);
}
return(FALSE);
}
示例7: setTitle
bool CListViewBasicTest::init()
{
CListViewTestSceneBase::init();
setTitle("CListViewBasicTest");
setDescription("ListView Test");
//test data
tagItem tag1 = { Size(480, 10), Color3B::WHITE };
tagItem tag2 = { Size(480, 20), Color3B::RED };
tagItem tag3 = { Size(480, 30), Color3B::GREEN };
tagItem tag4 = { Size(100, 40), Color3B::ORANGE };
tagItem tag5 = { Size(480, 50), Color3B::MAGENTA };
tagItem tag6 = { Size(400, 60), Color3B::BLUE };
tagItem tag7 = { Size(300, 80), Color3B::RED };
tagItem tag8 = { Size(480, 30), Color3B::GRAY };
tagItem tag9 = { Size(480, 40), Color3B::YELLOW };
m_lDatas.push_back(tag1);
m_lDatas.push_back(tag2);
m_lDatas.push_back(tag3);
m_lDatas.push_back(tag4);
m_lDatas.push_back(tag5);
m_lDatas.push_back(tag6);
m_lDatas.push_back(tag7);
m_lDatas.push_back(tag8);
m_lDatas.push_back(tag9);
//<<
m_pListView = CListView::create(Size(480, 320));
m_pListView->setBackgroundImage("background.png");
m_pListView->setPosition(Vec2(480, 320));
m_pListView->setDirection(eScrollViewDirectionVertical);
m_pWindow->addChild(m_pListView);
CButton* pButton = CButton::createWith9Sprite(Size(150, 50),
"sprite9_btn1.png", "sprite9_btn2.png");
pButton->setPosition(Vec2(150, 320));
pButton->setOnClickListener(this, ccw_click_selector(CListViewBasicTest::onClick));
pButton->initText("Add", "", 30);
m_pWindow->addChild(pButton);
return true;
}
示例8: onAddResourceBtn
void CTopLayer::onAddResourceBtn(CCObject* pSender)
{
CButton* btn = (CButton*)pSender;
if (!strcmp(btn->getId(),"btn_add_gold"))
{
CVipLayer *vipLayer= CVipLayer::create();
if(LayerManager::instance()->push(vipLayer))
{
GetTcpNet->sendDataType(VipInfoMsg,true);
GetTcpNet->sendDataType(VipShopMsg,true);
return;
}
}
/* return;*/
BuyResource *layer = dynamic_cast<BuyResource*>(LayerManager::instance()->getLayer("BuyResource"));
if (layer)
{
LayerManager::instance()->pop();
LayerManager::instance()->pop();
}
if(dynamic_cast<CPopTip*>(LayerManager::instance()->getLayer("BuyResourceText")))
{
return;
}
if (!strcmp(btn->getId(),"btn_add_food"))
{
BuyResource* bufLayer = BuyResource::create();
bufLayer->setExchangeType(BUY_FOOD);
LayerManager::instance()->push(bufLayer);
CPlayerControl::getInstance().sendConvert(2);
}
else if (!strcmp(btn->getId(),"btn_add_copper"))
{
BuyResource* bufLayer = BuyResource::create();
bufLayer->setExchangeType(BUY_COIN);
LayerManager::instance()->push(bufLayer);
CPlayerControl::getInstance().sendConvert(1);
}else if (!strcmp(btn->getId(),"btn_add_soul"))
{
}else if (!strcmp(btn->getId(),"btn_add_gold"))
{
// LayerManager::instance()->pop();
}
else if(!strcmp(btn->getId(),"btn_add_friendship"))
{
CPopTip* TopLayerText = ShowPopTextTip(GETLANGSTR(1114),ccWHITE,false);
TopLayerText->setName("BuyResourceText");
}
else{
// LayerManager::instance()->pop();
CCLOG("[ *ERROR ] CMainCityUI::onAddResourceBtn");
}
}
示例9: ActivateSelectionHook
LRESULT CMainDlg::OnSelectionComplete(WPARAM wParam, LPARAM lParam)
{
// Remove mouse hook
ActivateSelectionHook(FALSE);
// Grab screenshot
HBITMAP hScreenshotBmp = NULL;
if((m_hHilightWnd) && (::IsWindow(m_hHilightWnd)))
hScreenshotBmp = GetScreenshot(m_hHilightWnd, NULL);
// Check if we were launched from tray menu
if(!m_bStayInTray)
{
// Uncheck button
CButton* pBtn = (CButton*)GetDlgItem(IDC_WIN_SELECT);
ASSERT(pBtn);
pBtn->SetCheck(0);
// Restore self
ShowWindow(SW_RESTORE);
}
m_bStayInTray = FALSE;
// Do not continue if aquiring screenshot failed
if(!hScreenshotBmp)
return -1;
// Create file name
CString strFile = GetOutputFileName();
// Create full file path/name
CString strFilePath = m_strImagePath;
strFilePath += strFile;
// Save screenshot as jpeg
SaveImageAs(hScreenshotBmp, strFilePath);
// Clean up dib
::DeleteObject(hScreenshotBmp);
return 0;
}
示例10: dc
void CWelcomeWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting
// get our own DC instead, with no restrictions
CDC* pDC = GetDC();
// realize the palette
CPalette* pOldPalette = pDC->SelectPalette(m_bitmap.GetPalette(), FALSE);
pDC->RealizePalette();
// And draw the bitmap
BITMAP bmInfo;
if (m_bitmap.m_hObject == NULL)
return;
m_bitmap.GetObject(sizeof(BITMAP),&bmInfo);
CDC newDC;
newDC.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = newDC.SelectObject(&m_bitmap);
pDC->BitBlt(0,0,bmInfo.bmWidth,bmInfo.bmHeight,&newDC,0,0,SRCCOPY);
//
(void)newDC.SelectObject(pOldBitmap);
newDC.DeleteDC();
pDC->SelectPalette(pOldPalette, FALSE);
ReleaseDC(pDC);
// draw the 'OK' button
CRect winRect, rect;
GetClientRect(&winRect);
CButton* pBtn = (CButton*) GetDlgItem(IDOK);
pBtn->GetWindowRect(&rect);
ScreenToClient(&rect);
int nWidth = rect.Width();
int nHeight = rect.Height();
rect.bottom = winRect.bottom - 24;
rect.top = rect.bottom - nHeight;
rect.left = (winRect.right - nWidth) / 2;
rect.right = rect.left + nWidth;
pBtn->MoveWindow(&rect);
pBtn->ShowWindow(SW_SHOW);
}
示例11: OnBnClickedStart
void CBisonClickerDlg::OnBnClickedStart()
{
// TODO: 在此添加控件通知处理程序代码
CString GetTimes;
wp.ClickTimes = 0; wp.ClickInterval = 1;
wp.MouseFlag = m_Mouse.GetCurSel();
wp.HaveTimes = TimeFlag;
CButton *pBtn = NULL;
pBtn = (CButton*)GetDlgItem(IDC_CHECK_CLICK);
if (pBtn->GetCheck() == TRUE) //判断是否有设置点击次数
{
GetDlgItem(IDC_EDIT_TIMES)->GetWindowText(GetTimes);//获取点击次数
wp.ClickTimes = atoi(GetTimes);
}
GetDlgItem(IDC_EDIT_INTERVAL)->GetWindowText(GetTimes);//获取点击间隔
wp.ClickInterval = atoi(GetTimes);
if (wp.ClickInterval < 5){ wp.ClickInterval = 1; }
Work = CreateThread(NULL, 0, WorkThread, &wp, NULL, NULL);
}
示例12: OnBtnClickLock
void CdynControlDlg::OnBtnClickLock(UINT id)
{
int idx = id - LOCKBTN_ID_OFFSET;
CButton *btn = (CButton*)GetDlgItem(id);
CString str;
btn->GetWindowText(str);
if (str == _T("unlock")) {
btn->SetWindowText(_T("lock"));
log(_T("unlock 0x%02x\n"), idx);
jointPositionUnlock(cmd, &cmdLen, idx);
SendData(cmd, cmdLen);
} else {
btn->SetWindowText(_T("unlock"));
log(_T("lock 0x%02x\n"), idx);
jointPositionLock(cmd, &cmdLen, idx);
SendData(cmd, cmdLen);
}
}
示例13: GetDlgItem
BOOL CLoadDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CButton *radio = static_cast< CButton * >( GetDlgItem( IDC_LOADBYDATE ) );
if ( radio )
{
radio->SetCheck( 1 );
}
radio = static_cast< CButton * >( GetDlgItem( IDC_LOADALL ) );
if ( radio )
{
radio->SetCheck( 1 );
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例14: onClickDownloadPackage
void LoginLayerUC::onClickDownloadPackage( CCObject* pSender )
{
CButton* pBtn = (CButton*)pSender;
if(pBtn->getTag()==PopTipConfirm)
{
CDownloadPackage* pLayer = CDownloadPackage::create();
pLayer->setDownloadPacakgeDelegate(this);
CCDirector::sharedDirector()->getRunningScene()->addChild(pLayer, 1147);
pLayer->downLoadPackage();
}
else
{
//不更新,重启游戏,重复引导
//CJniHelper::getInstance()->restartGame();
CCDirector::sharedDirector()->end();
}
((CPopTip*)(pBtn->getParent()->getParent()))->removeFromParentAndCleanup(true);
}
示例15: MessageBox
void C多播收发:刘兴龙Dlg::OnBnClickedRadio2()
{
// 接收消息下线
if (Setinfo == 0){
MessageBox(L"还未设置好,请先设置!");
CButton* radio = (CButton*)GetDlgItem(IDC_RADIO2);
radio->SetCheck(0);
}else{
if (flag == 1){
flag = 0;
str = L"";
closesocket(sockM);
closesocket(sock);
WSACleanup();
MessageBox(L"下线成功!");
}else{
MessageBox(L"以是下线状态了!");
}
}
}