本文整理汇总了C++中CPaintDC类的典型用法代码示例。如果您正苦于以下问题:C++ CPaintDC类的具体用法?C++ CPaintDC怎么用?C++ CPaintDC使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPaintDC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetScrollPos
void CDataView::Render2D(CPaintDC& dc)
{
CRect updateRect = dc.m_ps.rcPaint;
int w = updateRect.Width();
int h = updateRect.Height();
int tx = updateRect.left;
int ty = updateRect.top;
int sx = std::max(0, GetScrollPos(SB_HORZ)) + tx;
int sy = std::max(0, GetScrollPos(SB_VERT)) + ty;
#if 1
dc.StretchBlt(
tx, ty, w, h,
m_memDC, sx/m_scale, sy/m_scale, w/m_scale, h/m_scale,
SRCCOPY
);
#else
dc.BitBlt(
tx,
ty,
w,
h,
m_memDC,
sx,
sy,
SRCCOPY
);
#endif
}
示例2: dc
void CStaticFilespec::OnPaint()
{
CPaintDC dc (this); // device context for painting
DWORD dwFormat; // text format
RECT rectWnd; // window rectangle
CString strText; // window text
CWnd* pWndParent = NULL; // parent window
// Set default font
pWndParent = GetParent();
if (pWndParent)
dc.SelectObject (pWndParent->GetFont());
// Draw text
GetWindowText (strText);
GetClientRect (&rectWnd);
dwFormat = m_dwFormat | (m_bPathEllipsis ? DT_PATH_ELLIPSIS : DT_END_ELLIPSIS);
::DrawTextEx (dc.m_hDC,
strText.GetBuffer (0),
strText.GetLength(),
&rectWnd,
dwFormat,
NULL);
strText.ReleaseBuffer();
// Do not call CWnd::OnPaint() for painting messages
}
示例3: DrawTree
void CChildView::DrawTree(CPaintDC& inDC, bool inUseRepaintRect)
{
if (_tree == nullptr)
return;
CPen leafPen(PS_SOLID, 1, RGB(0, 0, 255));
CBrush clearbrush;
clearbrush.CreateSolidBrush(RGB(255, 255, 255));
CBrush closedbrush;
closedbrush.CreateSolidBrush(RGB(155, 155, 155));
_tree->ForEachLeaf([&inDC, &clearbrush, &closedbrush, &leafPen](const CQuadLeaf& inLeaf)
{
inDC.SelectObject(&leafPen);
if (inLeaf.IsClear())
inDC.SelectObject(&clearbrush);
else
inDC.SelectObject(&closedbrush);
Rect2Df boundrect = inLeaf.GetBound();
inDC.Rectangle(&boundrect.GetWinRect());
});
}
示例4: dc
void CSplashWnd::OnPaint()
{
CPaintDC dc (this);
Graphics g (dc.GetSafeHdc ());
g.DrawImage ((Bitmap*) *m_pBitmap, 0, 0, m_nWidth, m_nHeight);
}
示例5: DrawLine
void CSeparator::DrawLine(CPaintDC &dc, CRect &clientRect)
{
HPEN hp = dc.SelectPen(Globals::Instance().sep.pen);
dc.MoveTo(clientRect.left, (clientRect.top + clientRect.bottom) / 2-1);
dc.LineTo(clientRect.right, (clientRect.top + clientRect.bottom) / 2-1);
dc.SelectPen(hp);
}
示例6: DrawAd
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);
}
}
示例7: DrawText
void CDepartmentEstimationDialog::DrawText(CPaintDC &dc, CString Text, COLORREF Color, int l, int t, int r, int b)
{
CRect TextRect(l, t, r, b);
dc.SetTextColor(Color);
dc.SetBkMode( TRANSPARENT );
dc.DrawText(Text, &TextRect, DT_SINGLELINE | DT_CENTER);
}
示例8: DrawField
void CModelFormItem::DrawField(CPaintDC & dc)
{
CRect rectItem;
GetClientRect(rectItem);
int eff = m_param.GetEndFirstField();
int bsf = m_param.GetBeginSecondField();
dc.MoveTo(eff, rectItem.top + 2);
dc.LineTo(eff, rectItem.bottom - 2);
dc.MoveTo(bsf, rectItem.top + 2);
dc.LineTo(bsf, rectItem.bottom - 2);
}
示例9: PaintItems
void CIperfView::PaintItems(CPaintDC &dc, CIperfViewItem *pa)
{
POSITION pos;
INT_PTR count;
INT_PTR idx = 0;
double x0 = 0, x1 = 0, y = 0;
double t0, t1;
double xstep, ystep;
double speed;
int fast = 0;
CRect rect;
count = pa->m_List.GetCount();
GetClientRect(&rect);
xstep = rect.Width() / 60.0;
ystep = rect.Height() / HEIGHT;
CPen pen(PS_SOLID, 1, pa->m_color);
CPen* pOldPen = dc.SelectObject(&pen);
for ( pos = pa->m_List.GetHeadPosition(); pos != NULL; pa->m_List.GetNext( pos ) )
{
t0 = pa->m_List.GetAt( pos ).t0;
t1 = pa->m_List.GetAt( pos ).t1;
if(pa->m_List.GetAt( pos ).speed) {
speed = 10*log10(pa->m_List.GetAt( pos ).speed);
} else {
speed = 0;
}
//
x0 = t0 * xstep;
x1 = t1 * xstep;
y = rect.Height() - speed * ystep;
// point set
CRect rect0( (int)x0-2, (int)y-2, (int)x0+2, (int)y+2);
CRect rect1( (int)x1-2, (int)y-2, (int)x1+2, (int)y+2);
//dc.Ellipse(rect0);
dc.Ellipse(rect1);
if(fast++ == 0)
dc.MoveTo(CPoint((int)x0,(int)y));
dc.LineTo(CPoint((int)x1,(int)y));
}
dc.SelectObject(pOldPen);
}
示例10: PaintVideoFrame
void CTimeEv::PaintVideoFrame(CPaintDC& dc)
{
if(!m_hdd)
return;
m_videoRect = m_MainRect;
m_videoRect.left += 11 + 550;
m_videoRect.bottom -= 4; //45
m_videoRect.top = m_videoRect.bottom - 206;
m_videoRect.right = m_videoRect.left + 275;
m_videoRect.left += 1;
m_videoRect.top += 1;
m_videoRect.right -= 1;
m_videoRect.bottom -= 1;
bool bChangeSz = false;
if(m_videoRect.Width() != m_iFrameW)
{
m_iFrameW = m_videoRect.Width();
bChangeSz = true;
}
if(m_videoRect.Height() != m_iFrameH)
{
m_iFrameH = m_videoRect.Height();
bChangeSz = true;
}
if(bChangeSz || !m_pDIBFrame)
{
if(m_pDIBFrame) delete [] m_pDIBFrame;
makeRgbDIB(m_pDIBFrame,m_iFrameW,m_iFrameH,0,0);
}
LPBITMAPINFOHEADER pBMP = m_oAVIR.GetCurrentFrame();
// SaveBMP(pBMP,"orig_frame.bmp");
if(!pBMP)
{ Write2Log("Couldn't extract frame %d",m_oAVIR.CurrentFrame());
return;
}
BITMAPINFOHEADER* pbmpnew = (BITMAPINFOHEADER*)m_pDIBFrame;
StretchDIB(pbmpnew,(byte*)pbmpnew+sizeof(BITMAPINFOHEADER),0,0,pbmpnew->biWidth,pbmpnew->biHeight,
pBMP,(byte*)pBMP+sizeof(BITMAPINFOHEADER),0,0,pBMP->biWidth,pBMP->biHeight);
//byte* pdata=(byte*)pBMP+pBMP->biSize+pBMP->biClrUsed*sizeof(RGBQUAD);
byte* pdata = (byte*)pbmpnew+sizeof(BITMAPINFOHEADER);
// SaveBMP(pbmpnew,"new_frame.bmp");
// Convert Data To Requested Bitmap Format & Draw IT!!!
DrawDibDraw(m_hdd, dc.GetSafeHdc(), m_videoRect.left, m_videoRect.top, pbmpnew->biWidth, pbmpnew->biHeight, pbmpnew, pdata, 0, 0, pbmpnew->biWidth, pbmpnew->biHeight, 0);
}
示例11: dc
void CMainWindow::OnPaint()
{
// Paint handler device context to THIS window!
CPaintDC dc (this);
CRect rect;
// current bounding rectangle of entire client area...
GetClientRect (&rect);
dc.DrawText("Hello, mo fo.",
-1 ,
&rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
示例12: DrawSquare
void CDepartmentEstimationDialog::DrawSquare(CPaintDC &dc, COLORREF Color, int l, int t, int r, int b)
{
CRect UserRect(l, t, r, b);
CBrush brush(Color);
dc.FillRect(UserRect, &brush);
brush.DeleteObject();
}
示例13: PaintXMaps
void CIperfView::PaintXMaps(CPaintDC &dc)
{
CRect rect;
GetClientRect(&rect);
double x, xstep;
xstep = rect.Width() / 60.0 * 2;
for(x =0.0; x < rect.Width() ; x += xstep)
{
CPen pen(PS_SOLID, 1, RGB(240,240,240));
CPen* pOldPen = dc.SelectObject(&pen);
dc.MoveTo(CPoint( (int)x, 1));
dc.LineTo(CPoint( (int)x, (int)rect.Height() - 1));
dc.SelectObject(pOldPen);
}
}
示例14: AxeGraph
void CAfficheMesPol::AxeGraph(CPaintDC &dc)
{
dc.FillSolidRect(PosGrX(0),PosGrY(255),PosGrX(255)-20,PosGrY(0)-40,RGB(255,255,255));
CPen PenAxe(PS_SOLID,1,RGB(0,0,0));
dc.SelectObject(&PenAxe);
dc.MoveTo(PosGrX(0),PosGrY(0));
dc.LineTo(PosGrX(0),PosGrY(255));
dc.MoveTo(PosGrX(0),PosGrY(0));
dc.LineTo(PosGrX(255),PosGrY(0));
for(int i=5;i<255;i+=5)
{
dc.MoveTo(PosGrX(0),PosGrY(i));
dc.LineTo(PosGrX(3),PosGrY(i));
dc.MoveTo(PosGrX(i),PosGrY(0));
dc.LineTo(PosGrX(i),PosGrY(3));
}
DeleteObject(&PenAxe);
}
示例15: DoPaint
// CFileOpenDlg::DoPaint
//
// Paints the splitter if it is displayed
//
void CFileOpenDlg::DoPaint(CPaintDC& dc)
{
if(m_nState == vsStandard)
{
CRect rcClient;
int y;
GetClientRect(&rcClient);
y = m_ySplit;
dc.MoveTo(0, y);
dc.LineTo(rcClient.right, y);
y += 6; // This is the splitter height
dc.MoveTo(0, y);
dc.LineTo(rcClient.right, y);
}
}