void CHeaderDockPane::DrawAd(CPaintDC & dc) { //CPaintDC dc(this); //CDC pDC; //pDC.CreateCompatibleDC(&dc); CRect rect; GetClientRect(&rect); if(rect.right > 500) { CBrush bg; bg.CreateStockObject(RGB(0,0,0)); CBrush fillBrush(RGB(250, 0, 0)); CBrush *oldFillBrush = dc.SelectObject(&fillBrush); //rect = CRect( CPoint(rect.left, rect.top), CPoint(rect.right, rect.bottom - 2) ); //rect = CRect( CPoint(200, 5), CPoint(400, 25) ); //dc.FillRect(&rect, &bg); int height = 22; int progress_x = rect.right - 300 - 1; int progress_y = -22; CPoint prorgess_border_points[5]; prorgess_border_points[0] = CPoint(progress_x, progress_y); prorgess_border_points[1] = CPoint(progress_x, progress_y + height); prorgess_border_points[2] = CPoint(progress_x+(rect.right - progress_x)-20 - 1, progress_y + height); prorgess_border_points[3] = CPoint(progress_x+(rect.right - progress_x)-20 - 1, progress_y); prorgess_border_points[4] = CPoint(progress_x, progress_y); CPen penOutline(PS_SOLID, 1, RGB(175, 175, 175)); dc.SelectObject(&penOutline); dc.Polyline(prorgess_border_points, 5); } }
void CMyToolBar::OnPaint () { CPaintDC pDC(this); //CRect rect; //GetClientRect (&rect); int progress_x = 1; int progress_y = 4; CPoint prorgess_border_points[5]; prorgess_border_points[0] = CPoint(progress_x, progress_y); prorgess_border_points[1] = CPoint(progress_x, progress_y + 5); prorgess_border_points[2] = CPoint(progress_x+75, progress_y + 5); prorgess_border_points[3] = CPoint(progress_x+75, progress_y); prorgess_border_points[4] = CPoint(progress_x, progress_y); CPen penOutline(PS_SOLID,1,RGB(204,204,204)); pDC.SelectObject(&penOutline); pDC.Polyline(prorgess_border_points, 5); }
void SurfaceImpl::PenColour(ColourDesired fore) { QPen penOutline(QColorFromCA(fore)); penOutline.setCapStyle(Qt::FlatCap); GetPainter()->setPen(penOutline); }
void RowHeading::Draw() { wxClientDC dc(this); wxCoord w,h; wxPen penOutline(wxColor(32,32,32), .1); dc.GetSize(&w,&h); wxBrush brush(mHeaderColorModel->asWxColor(),wxBRUSHSTYLE_SOLID); dc.SetBrush(brush); dc.SetPen(penOutline); int row=0; int startY = 0,endY = 0; for(int i =0;i< mSequenceElements->GetVisibleRowInformationSize();i++) { wxString prefix; if (mSequenceElements->GetVisibleRowInformation(i)->submodel) { prefix = " "; } wxBrush brush(GetHeaderColor(mSequenceElements->GetVisibleRowInformation(i))->asWxColor(),wxBRUSHSTYLE_SOLID); dc.SetBrush(brush); startY = DEFAULT_ROW_HEADING_HEIGHT*row; endY = DEFAULT_ROW_HEADING_HEIGHT*(row+1); dc.SetBackgroundMode(wxTRANSPARENT); dc.DrawRectangle(0,startY,w,DEFAULT_ROW_HEADING_HEIGHT); if(mSequenceElements->GetVisibleRowInformation(i)->layerIndex>0 || mSequenceElements->GetVisibleRowInformation(i)->strandIndex >= 0) // If effect layer = 0 { dc.SetPen(*wxLIGHT_GREY_PEN); dc.DrawLine(1,startY,w-1,startY); dc.DrawLine(1,startY-1,w-1,startY-1); dc.SetPen(*wxBLACK_PEN); if (mSequenceElements->GetVisibleRowInformation(i)->strandIndex >= 0) { wxRect r(DEFAULT_ROW_HEADING_MARGIN,startY,w-DEFAULT_ROW_HEADING_MARGIN,DEFAULT_ROW_HEADING_HEIGHT); wxString name = mSequenceElements->GetVisibleRowInformation(i)->displayName; if (name == "") { if (mSequenceElements->GetVisibleRowInformation(i)->nodeIndex >= 0) { name = wxString::Format("Node %d", mSequenceElements->GetVisibleRowInformation(i)->nodeIndex + 1); } else { name = wxString::Format("Strand %d", mSequenceElements->GetVisibleRowInformation(i)->strandIndex + 1); } } if (mSequenceElements->GetVisibleRowInformation(i)->nodeIndex >= 0) { dc.DrawLabel(prefix + " " + name,r,wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT); } else { dc.DrawLabel(prefix + " " + name,r,wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT); } } } else // Draw label { wxRect r(DEFAULT_ROW_HEADING_MARGIN,startY,w-DEFAULT_ROW_HEADING_MARGIN,DEFAULT_ROW_HEADING_HEIGHT); dc.DrawLabel(prefix + mSequenceElements->GetVisibleRowInformation(i)->element->GetName(),r,wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT); } if(mSequenceElements->GetVisibleRowInformation(i)->element->GetType()=="view") { dc.SetBrush(*wxWHITE_BRUSH); dc.SetPen(*wxBLACK_PEN); dc.DrawRectangle(2,startY+7,9,9); dc.DrawLine(4,startY+11,9,startY+11); if(mSequenceElements->GetVisibleRowInformation(i)->Collapsed) { dc.DrawLine(6,startY+9,6,startY+14); } dc.SetPen(penOutline); dc.SetBrush(brush); } else if (mSequenceElements->GetVisibleRowInformation(i)->element->GetType()=="model") { if(mSequenceElements->GetVisibleRowInformation(i)->element->GetEffectLayerCount() > 1 && mSequenceElements->GetVisibleRowInformation(i)->layerIndex == 0 && mSequenceElements->GetVisibleRowInformation(i)->strandIndex == -1) { dc.SetBrush(*wxWHITE_BRUSH); dc.SetPen(*wxBLACK_PEN); dc.DrawRectangle(2,startY + DEFAULT_ROW_HEADING_HEIGHT/2 - 4,9,9); dc.DrawLine(2,startY + DEFAULT_ROW_HEADING_HEIGHT/2,9,startY + DEFAULT_ROW_HEADING_HEIGHT/2); if(mSequenceElements->GetVisibleRowInformation(i)->Collapsed) { dc.DrawLine(6,startY + DEFAULT_ROW_HEADING_HEIGHT/2 + 4,6,startY + DEFAULT_ROW_HEADING_HEIGHT/2 - 4); } dc.SetPen(penOutline); dc.SetBrush(brush); } } else if(mSequenceElements->GetVisibleRowInformation(i)->element->GetType()=="timing") { if( mSequenceElements->GetVisibleRowInformation(i)->layerIndex == 0 ) { dc.SetPen(*wxBLACK_PEN); if(mSequenceElements->GetVisibleRowInformation(i)->Active) { dc.SetBrush(*wxWHITE_BRUSH); dc.DrawCircle(7,startY + DEFAULT_ROW_HEADING_HEIGHT/2,5); dc.SetBrush(*wxGREY_BRUSH); dc.DrawCircle(7,startY + DEFAULT_ROW_HEADING_HEIGHT/2,2); } else { dc.SetBrush(*wxWHITE_BRUSH); dc.DrawCircle(7,startY + DEFAULT_ROW_HEADING_HEIGHT/2,5); } dc.SetPen(penOutline); dc.SetBrush(brush); if(mSequenceElements->GetVisibleRowInformation(i)->element->GetEffectLayerCount() > 1) { dc.DrawBitmap(papagayo_icon, getWidth()-25, startY+3, true); } } } row++; } wxBrush b(mHeaderColorModel->asWxColor(),wxBRUSHSTYLE_SOLID); dc.SetBrush(b); dc.DrawRectangle(0,endY,w,h); }
int CXTPExcelTabCtrlTheme::DrawTab(CDC* pDC, CXTPExcelTabCtrl* pTabCtrl, const CPoint& pt, bool bSelected, CXTPTcbItem* pTcbItem) { if (pDC == NULL || pTcbItem == NULL || !::IsWindow(pTabCtrl->GetSafeHwnd())) return -1; // Saves the current state of the device context, we will // restore the state when the method looses scope. This will // simplify selecting objects. const int nSavedDC = pDC->SaveDC(); const int iHeight = m_cy; const int iBase = iHeight / 2; const int iWidth = iHeight + iHeight / 2; // 2 bases + 2 margins const bool bBottom = (pTabCtrl->GetTabStyle() & FTS_XTP_BOTTOM) == FTS_XTP_BOTTOM; pDC->SelectObject(pTabCtrl->GetTabFont(bSelected)); const CSize szText = pDC->GetTextExtent(pTcbItem->szTabLabel); CRect rcText; rcText.left = pt.x + iBase + iBase / 2; rcText.top = pt.y + ((iHeight - szText.cy)/2)-1; rcText.right = rcText.left + szText.cx; rcText.bottom = rcText.top + szText.cy; COLORREF crBack = GetTabBackColor(pTcbItem); COLORREF crFore = GetTabTextColor(pTcbItem); if (bSelected) { crBack = GetSelTabBackColor(pTcbItem); crFore = GetSelTabTextColor(pTcbItem); } CPen penBack(PS_SOLID, 1, crBack); CPen penWindow(PS_SOLID, 1, m_clr3DHilight); CPen penShadow(PS_SOLID, 1, m_clr3DShadow); CPen penOutline(PS_SOLID, 1, m_clrBtnText); CBrush brush; brush.CreateSolidBrush(crBack); POINT points[] = { { pt.x, pt.y + iHeight - 1 }, { pt.x + iBase - 1, pt.y }, { pt.x + szText.cx + iWidth - iBase - 1, pt.y }, { pt.x + szText.cx + iWidth - 1, pt.y + iHeight - 1 } }; // swap vertical coordinates if (bBottom) { points[0].y = points[1].y; points[2].y = points[3].y; points[1].y = points[2].y; points[3].y = points[0].y; } pDC->SelectObject(&penOutline); pDC->SetBkColor(crBack); pDC->SelectObject(&brush); pDC->Polygon(points, 4); pDC->SetTextColor(crFore); pDC->DrawText(pTcbItem->szTabLabel, rcText, DT_CENTER); pDC->SelectObject(&penShadow); if (bSelected) { pDC->MoveTo(pt.x + iBase, points[1].y); pDC->LineTo(pt.x + iBase * 2 + szText.cx - 1, points[1].y); pDC->SelectObject(&penBack); pDC->MoveTo(pt.x + 1, points[0].y); pDC->LineTo(pt.x + szText.cx + iWidth - 1, points[0].y); } else { // highlight line on left pDC->SelectObject(&penWindow); pDC->MoveTo(pt.x + 1, points[0].y); pDC->LineTo(pt.x + 1 + iBase, points[0].y + iHeight); // shadow line on top pDC->SelectObject(&penShadow); pDC->MoveTo(pt.x, points[0].y); pDC->LineTo(pt.x + szText.cx + iWidth, points[0].y); // shadow line on bottom pDC->MoveTo(pt.x + iBase, points[1].y); pDC->LineTo(pt.x + szText.cx + iHeight - 1, points[1].y); } // Cleanup. pDC->RestoreDC(nSavedDC); brush.DeleteObject(); return szText.cx + iWidth; }