/** * An x,y zeichnen. */ void noDisappearingMapEnvObject::Draw(DrawPoint drawPt) { // Bild LOADER.GetMapImageN(map_id)->DrawFull(drawPt, GetDrawColor()); // Schatten LOADER.GetMapImageN(map_id + 100)->DrawFull(drawPt, GetDrawShadowColor()); }
/** * An x,y zeichnen. * * @author OLiver */ void noDisappearingMapEnvObject::Draw(int x, int y) { // Bild LOADER.GetMapImageN(map_id)->Draw(x, y, 0, 0, 0, 0, 0, 0, GetDrawColor()); // Schatten LOADER.GetMapImageN(map_id + 100)->Draw(x, y, 0, 0, 0, 0, 0, 0, GetDrawShadowColor()); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CAvatarImagePanel::PaintBackground( void ) { vgui::IImage *pImage = GetImage(); if ( pImage ) { pImage->SetColor( GetDrawColor() ); pImage->Paint(); } }
//背景函数 BOOL CHappyGoDlg::OnEraseBkgnd(CDC * pDC) { CRect DrawRect,HeadRect; pDC->GetClipBox(&DrawRect); if (m_ListHeader.GetSafeHwnd()!=NULL) { m_ListHeader.GetWindowRect(&HeadRect); if (DrawRect.top<HeadRect.Height()) DrawRect.top=HeadRect.Height(); } COLORREF crTextColor,crBackColor; GetDrawColor(crTextColor,crBackColor,NULL,0,false); pDC->FillSolidRect(&DrawRect,crBackColor); return TRUE; }
/** * An x,y zeichnen. * * @author OLiver */ void noSign::Draw(int x, int y) { // Wenns verschwindet, muss es immer transparenter werden unsigned color = GetDrawColor(); // Schild selbst if(type != 5) LOADER.GetMapImageN(680 + type * 3 + quantity)->Draw(x, y, 0, 0, 0, 0, 0, 0, color); else // leeres Schild LOADER.GetMapImageN(695)->Draw(x, y, 0, 0, 0, 0, 0, 0, color); // Schatten des Schildes LOADER.GetMapImageN(700)->Draw(x, y, 0, 0, 0, 0, 0, 0, GetDrawShadowColor()); }
void UKUILineInterfaceComponent::ConstructNewItem() { if ( !HasValidComponents() ) return; stItem.Reset(); stItem = TSharedPtr<FCanvasLineItem>( new FCanvasLineItem( vOrigin, vEnd ) ); static_cast< FCanvasLineItem* >( &*stItem )->LineThickness = fThickness; static_cast< FCanvasLineItem* >( &*stItem )->SetColor( GetDrawColor().ReinterpretAsLinear() ); Super::ConstructNewItem(); }
void UKUIMaterialInterfaceComponent::ConstructNewItem() { if ( !HasValidComponents() ) return; stItem.Reset(); stItem = TSharedPtr<FCanvasTileItem>( new FCanvasTileItem( FVector2D::ZeroVector, mMaterialProxy, v2Size, v2MaterialCoords, v2MaterialCoords + v2MaterialSize ) ); static_cast<FCanvasTileItem*>(&*stItem)->SetColor( GetDrawColor().ReinterpretAsLinear() ); static_cast<FCanvasTileItem*>(&*stItem)->Rotation = rRotation; static_cast<FCanvasTileItem*>(&*stItem)->PivotPoint = v2PivotPoint; static_cast<FCanvasTileItem*>(&*stItem)->Z = fDepth; Super::ConstructNewItem(); }
//绘画函数 void CHappyGoDlg::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (lpDrawItemStruct->CtlType==ODT_LISTVIEW) { //获取数据 UINT iWidth=0; TCHAR szBuffer[30]; memset(szBuffer,0,sizeof(szBuffer)); CDC * pDcItem=CDC::FromHandle(lpDrawItemStruct->hDC); /// 创建内存缓冲DC CBitmap BufBmp; CDC dc; CDC *pDC = &dc; CRect rc; GetClientRect(&rc); BufBmp.CreateCompatibleBitmap(pDcItem, rc.Width(), rc.Height()); dc.CreateCompatibleDC(pDcItem); CBitmap * pOldBmp=dc.SelectObject(&BufBmp); /// 选择字体 CFont *pDefaultFont = pDcItem->GetCurrentFont(); CFont *pOldFont = dc.SelectObject(pDefaultFont); UserItemStruct * pUserItem=(UserItemStruct *)GetItemData(lpDrawItemStruct->itemID); if (NULL == pUserItem) { dc.SelectObject(pOldBmp); BufBmp.DeleteObject(); dc.DeleteDC(); pDcItem->DeleteDC(); return ; } //设置颜色 COLORREF crTextColor,crBackColor; bool bSelect=(lpDrawItemStruct->itemState&ODS_SELECTED);//||(lpDrawItemStruct->itemState&ODS_FOCUS); GetDrawColor(crTextColor,crBackColor,pUserItem,0,bSelect); pDC->SetBkColor(crBackColor); pDC->SetTextColor(crTextColor); pDC->SetBkMode(TRANSPARENT); //绘画信息 CSize TextSize; pDC->FillSolidRect(lpDrawItemStruct->rcItem.left, lpDrawItemStruct->rcItem.top, lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left, lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top, crBackColor); if((lpDrawItemStruct->itemState&ODS_SELECTED)||(lpDrawItemStruct->itemState&ODS_FOCUS)) {//画虚框 int mode=pDC->SetBkMode(TRANSPARENT); CPen penBlack,*pOldPen; //penBlack.DeleteObject(); if(lpDrawItemStruct->itemState&ODS_SELECTED) { if(penBlack.CreatePen(PS_DOT,1, m_bkColor));// RGB(255,255,255))); pOldPen=pDC->SelectObject(&penBlack); } else { if(penBlack.CreatePen(PS_DOT,1, m_FocusbkColor));// RGB(0,0,0))); pOldPen=pDC->SelectObject(&penBlack); } pDC->SelectStockObject(NULL_BRUSH); pDC->Rectangle(lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top, lpDrawItemStruct->rcItem.right,lpDrawItemStruct->rcItem.bottom); pDC->SetBkMode(mode); /// {{ Added by zxd 20100709 释放GDI资源 pDC->SelectObject(pOldPen); penBlack.DeleteObject(); /// Added by zxd 20100709 释放GDI资源}} } BOOL bDraw; ///< 是否画用户状态图 HDITEM hdi; TCHAR lpBuffer[256]; hdi.mask = HDI_TEXT; hdi.pszText = lpBuffer; hdi.cchTextMax = 256; MapColumn::iterator ite; ite = m_MapColumn.find("Nickname"); for (int i=0;i<m_ListHeader.GetItemCount();i++) { memset(lpBuffer,0,sizeof(TCHAR)*256); m_ListHeader.GetItem(i,&hdi); ///< 获取ListCtrl的列表名 bDraw = FALSE; if (m_MapColumn.end() != ite) { if (0 ==_stricmp(lpBuffer,ite->second.ColumnName)) ///< 画用户状态图 { CImageList *imgList = GetImageList(LVSIL_SMALL); if(imgList) { POINT pt; int IconID = GetStateImageIndex(pUserItem); pt.x = lpDrawItemStruct->rcItem.left+iWidth; pt.y = lpDrawItemStruct->rcItem.top; imgList->Draw(pDC,IconID,pt,ILD_TRANSPARENT); if (::g_global.bEnableUserType) { pt.x += 27; m_UserTypeList.Draw(pDC,pUserItem->GameUserInfo.userType,pt,ILD_TRANSPARENT); } if (::g_global.bEnableDiamondUserType)//邮游钻石身份标识 add by huangYuanSong 09.07.14 { pt.x += 24; if (pUserItem->GameUserInfo.userInfoEx1 > 0 ) { m_UserDiamondTypeList.Draw(pDC,0,pt,ILD_TRANSPARENT); } } bDraw = TRUE; } } } int iTemp = GetColumnWidth(i); TextSize = pDC->GetTextExtent(szBuffer,lstrlen(szBuffer)); GetItemText(lpDrawItemStruct->itemID,i,szBuffer,sizeof(szBuffer)); CRect TextRect(lpDrawItemStruct->rcItem.left+iWidth+5, lpDrawItemStruct->rcItem.top, lpDrawItemStruct->rcItem.left+iWidth+iTemp, lpDrawItemStruct->rcItem.bottom); if (bDraw) { ///< 此次列是用户名称Nickname,名称前画了图,输出文字需右移32 TextRect.left += 32; //wushuqun 2009.6.26 if (::g_global.bEnableUserType) { TextRect.left += 24; } if (::g_global.bEnableDiamondUserType)//邮游钻石身份标识 add by huangYuanSong 09.07.14 { TextRect.left += 16; } } pDC->DrawText(szBuffer,lstrlen(szBuffer),&TextRect,(bDraw?DT_LEFT:DT_CENTER)|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); iWidth += iTemp; } //绘画屏幕 pDcItem->BitBlt( lpDrawItemStruct->rcItem.left, lpDrawItemStruct->rcItem.top, lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left, lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top, &dc, lpDrawItemStruct->rcItem.left, lpDrawItemStruct->rcItem.top, SRCCOPY); dc.SelectObject(pOldBmp); dc.SelectObject(pOldFont); BufBmp.DeleteObject(); dc.DeleteDC(); } return; }
//绘画函数 void CHappyGoDlgT::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (lpDrawItemStruct->CtlType==ODT_LISTVIEW) { //获取数据 UINT iWidth=0; TCHAR szBuffer[30]; CSize TextSize; memset(szBuffer,0,sizeof(szBuffer)); CDC * pDC=CDC::FromHandle(lpDrawItemStruct->hDC); CRect rect; GetClientRect(&rect); CDC memDC; memDC.CreateCompatibleDC(pDC); CBitmap Screen; Screen.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height()); memDC.SelectObject(&Screen); CFont *pOldFont = memDC.SelectObject(&m_Font); Screen.DeleteObject(); memDC.SetBkMode(TRANSPARENT); memDC.FillSolidRect(&rect,RGB(255,0,255)); //设置颜色 COLORREF crTextColor,crBackColor; bool bSelect=(lpDrawItemStruct->itemState&ODS_SELECTED);//||(lpDrawItemStruct->itemState&ODS_FOCUS); GetDrawColor(crTextColor,crBackColor,0,bSelect); memDC.SetBkColor(crBackColor); memDC.SetTextColor(crTextColor); //memDC.SelectObject(m_Font); memDC.SetBkMode(TRANSPARENT); // 绘制背景 if(lpDrawItemStruct->itemID % 2 == 0) memDC.FillSolidRect(lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top, lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top,RGB(154,169,200)); else memDC.FillSolidRect(lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top, lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top,RGB(213,218,238)); //绘画信息 if(bSelect) { memDC.FillSolidRect(lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top, lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top,crBackColor); } for (int i=0;i<m_ListHeader.GetItemCount();i++) { int iTemp=GetColumnWidth(i); if(m_processpos == i) { TextSize=pDC->GetTextExtent(szBuffer,lstrlen(szBuffer)); GetItemText(lpDrawItemStruct->itemID,i,szBuffer,sizeof(szBuffer)); CRect TextRect(lpDrawItemStruct->rcItem.left+iWidth,lpDrawItemStruct->rcItem.top,lpDrawItemStruct->rcItem.left+iWidth+iTemp,lpDrawItemStruct->rcItem.bottom); if(!m_probgImage.IsNull() && !m_proImage.IsNull()) { m_probgImage.Draw(memDC, CRect(TextRect.left,TextRect.top,TextRect.left+m_probgImage.GetWidth(),TextRect.top+m_probgImage.GetHeight()), CRect(0,0,m_probgImage.GetWidth(),m_probgImage.GetHeight())); int length = (int)(m_probgImage.GetWidth() * (m_ProgressList[lpDrawItemStruct->itemID] / 100.0f)); int count = length / m_proImage.GetWidth() - 2; for(int i=0;i<count;i++) { m_proImage.Draw(memDC,TextRect.left+i*m_proImage.GetWidth()+1,TextRect.top); } char buff[128]; sprintf(buff,"%d",m_ProgressList[lpDrawItemStruct->itemID]); strcat(buff," %"); memDC.DrawText(buff,lstrlen(buff),TextRect,DT_RIGHT|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); } iWidth+=iTemp; continue; } else { TextSize=pDC->GetTextExtent(szBuffer,lstrlen(szBuffer)); GetItemText(lpDrawItemStruct->itemID,i,szBuffer,sizeof(szBuffer)); CRect TextRect(lpDrawItemStruct->rcItem.left+iWidth,lpDrawItemStruct->rcItem.top,lpDrawItemStruct->rcItem.left+iWidth+iTemp,lpDrawItemStruct->rcItem.bottom); memDC.DrawText(szBuffer,lstrlen(szBuffer),&TextRect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); iWidth+=iTemp; } } pDC->TransparentBlt(rect.left, rect.top, rect.Width(), rect.Height(), &memDC, rect.left,rect.top,rect.Width(),rect.Height(),RGB(255,0,255)); memDC.SelectObject(pOldFont); //dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), &memDC, 0, 0, SRCCOPY); memDC.DeleteDC(); } return; }