// マウスイベント時のボタン描画処理の前処理 void Controls::DrawImageButtonOnMouseEvent(HWND hWnd_button, int flag) { HDC hdc_button; int id; CONTROLINFO *lpControlInfo; id = (int)GetWindowLongPtr(hWnd_button, GWLP_USERDATA); lpControlInfo = &controlinfo[id]; if (lpControlInfo->hWnd_control != hWnd_button) return; if (flag) { if (lpControlInfo->option & 0x1) return; TRACKMOUSEEVENT tme; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = hWnd_button; TrackMouseEvent(&tme); lpControlInfo->option |= 0x1; } else { if (!(lpControlInfo->option & 0x1)) return; lpControlInfo->option &= ~0x1; } lpControlInfo->drawmode = flag; hdc_button = GetDC(hWnd_button); DrawImageButton(lpControlInfo, hdc_button); ReleaseDC(hWnd_button, hdc_button); return; }
void GUIButton::Draw(Bitmap *ds) { bool draw_disabled = !IsEnabled(); check_font(&Font); // if it's "Unchanged when disabled" or "GUI Off", don't grey out if (gui_disabled_style == GUIDIS_UNCHANGED || gui_disabled_style == GUIDIS_GUIOFF) { draw_disabled = false; } // TODO: should only change properties in reaction to particular events if (CurrentImage <= 0 || draw_disabled) CurrentImage = Image; if (draw_disabled && gui_disabled_style == GUIDIS_BLACKOUT) // buttons off when disabled - no point carrying on return; // CHECKME: why testing both CurrentImage and Image? if (CurrentImage > 0 && Image > 0) DrawImageButton(ds, draw_disabled); // CHECKME: why don't draw frame if no Text? this will make button completely invisible! else if (!_text.IsEmpty()) DrawTextButton(ds, draw_disabled); }
void CGame::GameDraw(CDC * pDC) { m_dcBuffer.CreateCompatibleDC( pDC); m_dcImage.CreateCompatibleDC(pDC); m_dcMask.CreateCompatibleDC(pDC); m_dcBuffer.SelectObject(m_bit[0]); //»æÖƱ³¾° m_dcImage.SelectObject(m_bit[1]); m_dcBuffer.BitBlt(0,0,780,600,&m_dcImage,0,0,SRCCOPY); if (m_gameState==FAIPAI) { if (m_isShuffle) { m_dcImage.SelectObject(m_bit[3]); // m_dcBuffer.BitBlt(250,50,255,164,&m_dcImage,m_imageIndex*255,0,SRCCOPY); m_dcBuffer.TransparentBlt(250,50,255,164,&m_dcImage,m_imageIndex*255,0,255,164,RGB(16,101,148)); } if (m_isSendCard) { m_dcImage.SelectObject(m_bit[2]); for (int i=0;i<m_cardNums;i++) { m_dcBuffer.BitBlt(150+8*i,20,80-4,105-3,&m_dcImage,80*2+2,105*4+2,SRCCOPY); } } calculateTwoPoint(150+8*m_cardNums,20,m_card[54-m_cardNums].coord_x,m_card[54-m_cardNums].coord_y); // m_dcBuffer.BitBlt((m_coor_y-m_b)/m_k,m_coor_y,80,105,&m_dcImage,80*2,4*105,SRCCOPY); m_dcBuffer.TransparentBlt((m_coor_y-m_b)/m_k,m_coor_y,80,105,&m_dcImage,80*2,4*105,80,105,RGB(255,0,255)); } //»æÖÆÍæ¼Ò DrawPlayer(m_playA); DrawPlayer(m_playB); DrawPlayer(m_playC); //»æÖƵØÖ÷ DrawHost(); //»æÖÆ°´Å¥Í¼Æ¬ DrawImageButton(); DrawSendCard(); DrawPass();//»æÖÆpass pDC->BitBlt(0,0,780,600,&m_dcBuffer,0,0,SRCCOPY); m_dcBuffer.DeleteDC(); m_dcImage.DeleteDC(); m_dcMask.DeleteDC(); }
// オーナードロー時の描画処理の前処理 void Controls::DrawImageButtonOnOwnerDraw(HWND hWnd_button, HDC hdc_button, UINT state) { int id; CONTROLINFO *lpControlInfo; id = (int)GetWindowLongPtr(hWnd_button, GWLP_USERDATA); lpControlInfo = &controlinfo[id]; if (lpControlInfo->hWnd_control != hWnd_button) return; if (state & ODS_FOCUS ) { lpControlInfo->option |= 0x2; } else { lpControlInfo->option &= ~0x2; } if (state & ODS_SELECTED ) lpControlInfo->drawmode = 2; DrawImageButton(lpControlInfo, hdc_button); return; }