fix: read source, pen object use
This commit is contained in:
parent
7f2a357bd3
commit
ac1043f2e2
|
@ -46,8 +46,9 @@ void CDetailView::OnDraw(CDC* pDc) {
|
|||
MemDC.CreateCompatibleDC(pDc);
|
||||
|
||||
CBitmap Bitmap, * OldBitmap;
|
||||
CPen pen(PS_SOLID, 3, RGB(255, 255, 255));
|
||||
CPen* oldpen = MemDC.SelectObject(&pen);
|
||||
CPen linePen(PS_SOLID, 3, RGB(255, 255, 255));
|
||||
CPen cursorPen(PS_SOLID, 5, RGB(0, 255, 0));
|
||||
MemDC.SelectObject(&linePen);
|
||||
|
||||
Bitmap.CreateCompatibleBitmap(pDc, rect.Width(), rect.Height());
|
||||
OldBitmap = MemDC.SelectObject(&Bitmap);
|
||||
|
@ -67,8 +68,8 @@ void CDetailView::OnDraw(CDC* pDc) {
|
|||
MemDC.LineTo((i - L) * ZF, rect.Height() - log10(max(pDoc->m_nChannelSmooth[i], 1)) * rect.Height() / log10(nMaxCount));
|
||||
}
|
||||
// »æÖƹâ±êÊúÏß
|
||||
pen.CreatePen(PS_SOLID, 5, RGB(0, 255, 0));
|
||||
MemDC.SelectObject(&pen);
|
||||
linePen.DeleteObject();
|
||||
CPen* oldpen = MemDC.SelectObject(&cursorPen);
|
||||
MemDC.MoveTo(nX, 0);
|
||||
MemDC.LineTo(nX, rect.Height());
|
||||
|
||||
|
@ -76,7 +77,7 @@ void CDetailView::OnDraw(CDC* pDc) {
|
|||
pDc->BitBlt(0, 0, rect.Width(), rect.Width(), &MemDC, 0, 0, SRCCOPY);
|
||||
MemDC.SelectObject(oldpen);
|
||||
MemDC.SelectObject(OldBitmap);
|
||||
pen.DeleteObject();
|
||||
cursorPen.DeleteObject();
|
||||
Bitmap.DeleteObject();
|
||||
MemDC.DeleteDC();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ void CMCAView::Dump(CDumpContext& dc) const {
|
|||
CView::Dump(dc);
|
||||
}
|
||||
|
||||
CMCADoc* CMCAView::GetDocument() const // 非调试版本是内联的 {
|
||||
CMCADoc* CMCAView::GetDocument() const { // 非调试版本是内联的
|
||||
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMCADoc)));
|
||||
return (CMCADoc*)m_pDocument;
|
||||
}
|
||||
|
|
|
@ -474,7 +474,7 @@ void CMainFrame::OnUpdateSimuCo(CCmdUI* pCmdUI) {
|
|||
void CMainFrame::OnSimuCs() {
|
||||
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
|
||||
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
||||
OnSimuCoOpt();
|
||||
OnSimuCsOpt();
|
||||
OnStaStop();
|
||||
OnStaClear();
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void CMainFrame::OnUpdateSimuCs(CCmdUI* pCmdUI) {
|
|||
void CMainFrame::OnSimuNa() {
|
||||
if (pDoc == nullptr) pDoc = (CMCADoc*)GetActiveDocument();
|
||||
if (pView == nullptr) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
||||
OnSimuCoOpt();
|
||||
OnSimuNaOpt();
|
||||
OnStaStop();
|
||||
OnStaClear();
|
||||
}
|
||||
|
|
|
@ -39,8 +39,10 @@ void CTotalView::OnDraw(CDC* pDc) {
|
|||
|
||||
CRect rect;
|
||||
CBitmap Bitmap, * OldBitmap;
|
||||
CPen pen(PS_SOLID, 3, RGB(0, 0, 0));
|
||||
CPen* oldpen = MemDC.SelectObject(&pen);
|
||||
CPen linePen(PS_SOLID, 3, RGB(0, 0, 0));
|
||||
CPen cursor1Pen(PS_SOLID, 5, RGB(255, 0, 0));
|
||||
CPen cursor2Pen(PS_SOLID, 5, RGB(0, 255, 0));
|
||||
MemDC.SelectObject(&linePen);
|
||||
|
||||
GetClientRect(&rect);
|
||||
Bitmap.CreateCompatibleBitmap(pDc, rect.Width(), rect.Height());
|
||||
|
@ -59,18 +61,18 @@ void CTotalView::OnDraw(CDC* pDc) {
|
|||
MemDC.LineTo(2 * i + 1, rect.Height() - log10(max(pDoc->m_nChannelSmooth[i], 1)) * rect.Height() / log10(pView->m_nLC));
|
||||
}
|
||||
// 绘制光标竖线
|
||||
pen.CreatePen(PS_SOLID, 5, RGB(255, 0, 0));
|
||||
MemDC.SelectObject(&pen);
|
||||
linePen.DeleteObject();
|
||||
MemDC.SelectObject(&cursor1Pen);
|
||||
MemDC.MoveTo(2 * pView->m_nCursor1 + 1, 0);
|
||||
MemDC.LineTo(2 * pView->m_nCursor1 + 1, rect.Height());
|
||||
pen.CreatePen(PS_SOLID, 5, RGB(0, 255, 0));
|
||||
MemDC.SelectObject(&pen);
|
||||
cursor1Pen.DeleteObject();
|
||||
CPen* oldpen = MemDC.SelectObject(&cursor2Pen);
|
||||
MemDC.MoveTo(2 * pView->m_nCursor2 + 1, 0);
|
||||
MemDC.LineTo(2 * pView->m_nCursor2 + 1, rect.Height());
|
||||
|
||||
//释放资源
|
||||
MemDC.SelectObject(oldpen);
|
||||
pen.DeleteObject();
|
||||
cursor2Pen.DeleteObject();
|
||||
|
||||
pDc->BitBlt(0, 0, rect.Width(), rect.Height(), &MemDC, 0, 0, SRCCOPY);
|
||||
MemDC.SelectObject(OldBitmap);
|
||||
|
|
Reference in New Issue