void GVSearchListBox::DrawItem(LPDRAWITEMSTRUCT lpdis) { std::lock_guard<std::recursive_mutex> l(mutex_); switch (lpdis->itemAction) { case ODA_DRAWENTIRE: { if (lpdis->itemState & ODS_SELECTED) { DrawSelected(lpdis); } else { DrawEntire(lpdis); } } break; case ODA_SELECT: { if (lpdis->itemState & ODS_SELECTED) { DrawSelected(lpdis); } else { DrawEntire(lpdis); } } break; default: break; } RECT rect(lpdis->rcItem); HPEN hpen = CreatePen(PS_SOLID, 1, RGB(248, 248, 248)); HBRUSH hbrush = CreateSolidBrush(RGB(248, 248, 248)); SelectObject(lpdis->hDC, hpen); SelectObject(lpdis->hDC, hbrush); Rectangle(lpdis->hDC, rect.left + 12, rect.bottom - 1, rect.right - 12, rect.bottom); DeleteObject(hpen); DeleteObject(hbrush); DrawAvatar(lpdis); DrawMessage(lpdis); DrawVia(lpdis); }
/*! Draw current selected card // \param ATL_DRAWINFO& di : */ HRESULT CAxJpgCard::OnDraw(ATL_DRAWINFO& di) { RECT& rc = *(RECT*)di.prcBounds; HDC hdcComp = CreateCompatibleDC(di.hdcDraw); short iType; m_hCurrentImage->get_Type(&iType); ATLASSERT(iType == PICTYPE_BITMAP); //CreateDib(hdcComp); //SelectObject(hdcComp, (HBITMAP)m_hCurrentImage); SelectObject(hdcComp, m_hCurrentBitmap); // draw a contour rectangle if (m_eCardStatus != CSW_ST_MAZZO) Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom); rc.left += e_OverLine; rc.right -= e_OverLine; rc.top += e_OverLine; rc.bottom -= e_OverLine; m_rc = rc; switch (m_eCardStatus) { case CSW_ST_DRAWFIRST: // first draw GetDIBColorTable(hdcComp, 0, 256, m_pColors ); //DrawEmpty(rc, di.hdcDraw, hdcComp); //m_eCardStatus = CSW_ST_EMPTY; DrawNormal(rc, di.hdcDraw, hdcComp); m_eCardStatus = CSW_ST_DRAWNORMAL; //DrawAsMazzo(rc, di.hdcDraw, hdcComp); //m_eCardStatus = CSW_ST_MAZZO; //DrawRotated(rc, di.hdcDraw, hdcComp); //m_eCardStatus = CSW_ST_ROTATE90; //::OutputDebugString("Draw First\n"); break; case CSW_ST_MAZZO: // deck draw (mazzo) DrawAsMazzo(rc, di.hdcDraw, hdcComp); //::OutputDebugString("Draw Mazzo\n"); case CSW_ST_DRAWNORMAL: // usual draw DrawNormal(rc, di.hdcDraw, hdcComp); //::OutputDebugString("Draw Normal\n"); break; case CSW_ST_ANIMATETOBLACK: // animate bitmap color to black AnimateToBlack(rc, di.hdcDraw, hdcComp); m_eCardStatus = CSW_ST_EMPTY; //::OutputDebugString("Animate to black\n"); break; case CSW_ST_INVISIBLE: DrawInvisibile(rc, di.hdcDraw, hdcComp); m_eOldStatus = CSW_ST_INVISIBLE; //::OutputDebugString("Control invisible\n"); break; case CSW_ST_ROTATE90: DrawRotated(rc, di.hdcDraw, hdcComp); //::OutputDebugString("Draw rotate 90\n"); break; case CSW_ST_EMPTY: DrawEmpty(rc, di.hdcDraw, hdcComp); //::OutputDebugString("Draw Empty\n"); break; case CSW_ST_RESTORE: DrawOriginalColors(rc, di.hdcDraw, hdcComp); m_eCardStatus = CSW_ST_DRAWNORMAL; //::OutputDebugString("Draw restore\n"); break; case CSW_ST_SELECTED1: DrawSelected(rc, di.hdcDraw, hdcComp,1); m_eCardStatus = CSW_ST_SELECTED1; break; case CSW_ST_SELECTED2: DrawSelected(rc, di.hdcDraw, hdcComp,2); m_eCardStatus = CSW_ST_SELECTED2; break; default: _ASSERT(0); } DeleteDC(hdcComp); return S_OK; }
void ToolDoorEdit::Render() { ui::Manager::_tagINPUTINFO *pInputInfo = ui::Manager::GetInstance()->GetInputInfoBuffer(); render::Interface *pInterface = render::Interface::GetInstance(); render::Interface::Layer2D *pLayer2D = pInterface->GetLayer2D(); render::Interface::Layer3D *pLayer3D = pInterface->GetLayer3D(); EditWnd *pEditWnd = CommUI::GetInstance()->GetEditWnd(); WndDoorEdit *pWndDoorEdit= pEditWnd->GetWndDoorEdit(); DWORD dwSelIndex = pWndDoorEdit->GetCurDoorIndex(); switch(m_eEditStatus) { case DEST_SELECT: if (m_bDrag) { //画拖动线 pLayer2D->DrawWireQuadRect(m_ptDragStart.x,m_ptDragStart.y,pInputInfo->ptMouse.x,pInputInfo->ptMouse.y,0xffffffff); } DrawSelected(); break; case DEST_PALACE: { D3DXMATRIX matTRS; //显示被点亮的格子 static GameSelectRay cSelRay; RECT rc; pEditWnd->GetWndRect(&rc); cSelRay.CalculateRay(&rc,pEditWnd->GetCamera(),pInputInfo->ptMouse); //显示格子 EditMap *pMap = CommDB::GetInstance()->GetMap(); if (pMap) { VisibleSet *pSet = pMap->GetVisibleSet(); DWORD *pVIArray = pSet->GetVisibleIndexArray(); TerrainMesh *pMesh = CommDB::GetInstance()->GetTerrainMesh(); TerrainMesh::_tagGrid *pGrid(NULL); TerrainMesh::_tagVertex *pVertexArray = pMesh->GetVertexList(); D3DXVECTOR3 pos[4]; D3DXVECTOR3 vCenter; for(DWORD n = 0; n< pSet->GetVisibleIndexCount(); n++) { DWORD dwGridIndex = pVIArray[n]; pGrid = pMesh->GetGrid(dwGridIndex); for(DWORD v= 0; v < 4; v++) { pos[v] = pVertexArray[pGrid->dwVertexIndex[v]].vPosition; } vCenter = (pos[0] + pos[1] + pos[2] + pos[3]) / 4.0f; if (cSelRay.IntersectTri(&pos[0],&pos[1],&pos[2],NULL,NULL) || cSelRay.IntersectTri(&pos[0],&pos[2],&pos[3],NULL,NULL)) { //这个格子被选中 pLayer3D->_DEBUG_DrawWireQuad(&pos[0],&pos[1],&pos[2],&pos[3],0xffff0000); D3DXMatrixTranslation(&matTRS,vCenter.x,vCenter.y,vCenter.z); RnderDoorModel(&matTRS); break; } } } } break; } _ShowStatus(); }