2022-03-20 15:14:44 +08:00
|
|
|
|
// DetailView.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
|
|
#include "MCA.h"
|
|
|
|
|
#include "MCADoc.h"
|
|
|
|
|
#include "DetailView.h"
|
2022-05-31 22:21:20 +08:00
|
|
|
|
#include "ControlView.h"
|
2022-03-20 15:14:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNCREATE(CDetailView, CView)
|
|
|
|
|
|
|
|
|
|
CDetailView::CDetailView()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CDetailView::~CDetailView()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDetailView, CView)
|
2022-05-31 22:21:20 +08:00
|
|
|
|
ON_WM_PAINT()
|
|
|
|
|
ON_WM_ERASEBKGND()
|
|
|
|
|
ON_WM_LBUTTONDOWN()
|
|
|
|
|
ON_WM_RBUTTONDOWN()
|
2022-03-20 15:14:44 +08:00
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView <20><>ͼ
|
|
|
|
|
|
2022-05-31 22:21:20 +08:00
|
|
|
|
void CDetailView::OnDraw(CDC* pDc)
|
2022-03-20 15:14:44 +08:00
|
|
|
|
{
|
2022-05-31 22:21:20 +08:00
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
int L, R;
|
|
|
|
|
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
|
|
|
|
|
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
|
|
|
|
L = pView->m_nCursor1;
|
|
|
|
|
R = pView->m_nCursor2;
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
CRect rect;
|
|
|
|
|
GetClientRect(&rect);
|
|
|
|
|
ZF = rect.Width() / (R - L + 1.);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CDC MemDC;
|
|
|
|
|
CBitmap Bitmap, * OldBitmap;
|
|
|
|
|
CPen pen(PS_SOLID, 2, RGB(255, 255, 255));
|
|
|
|
|
CPen* oldpen = MemDC.SelectObject(&pen);
|
|
|
|
|
|
|
|
|
|
GetClientRect(&rect);
|
|
|
|
|
MemDC.CreateCompatibleDC(pDc);
|
|
|
|
|
Bitmap.CreateCompatibleBitmap(pDc, rect.Width(), rect.Height());
|
|
|
|
|
OldBitmap = MemDC.SelectObject(&Bitmap);
|
|
|
|
|
MemDC.FillSolidRect(0, 0, rect.Width(), rect.Height(), RGB(119, 7, 243));
|
|
|
|
|
|
|
|
|
|
// <20><>ͼ
|
|
|
|
|
MemDC.MoveTo(1, rect.Height() - pDoc->m_nChannelCount[L]);
|
|
|
|
|
for (int i = L; i <= R; i++)
|
|
|
|
|
MemDC.LineTo((i - L) * ZF, rect.Height() - pDoc->m_nChannelCount[i]);
|
|
|
|
|
|
|
|
|
|
//<2F>ͷ<EFBFBD><CDB7><EFBFBD>Դ
|
|
|
|
|
pDc->BitBlt(0, 0, rect.Width(), rect.Width(), &MemDC, 0, 0, SRCCOPY);
|
|
|
|
|
MemDC.SelectObject(oldpen);
|
|
|
|
|
MemDC.SelectObject(OldBitmap);
|
|
|
|
|
pen.DeleteObject();
|
|
|
|
|
Bitmap.DeleteObject();
|
|
|
|
|
MemDC.DeleteDC();
|
2022-03-20 15:14:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
void CDetailView::AssertValid() const
|
|
|
|
|
{
|
|
|
|
|
CView::AssertValid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef _WIN32_WCE
|
|
|
|
|
void CDetailView::Dump(CDumpContext& dc) const
|
|
|
|
|
{
|
|
|
|
|
CView::Dump(dc);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif //_DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-05-31 22:21:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CDetailView::OnPaint()
|
|
|
|
|
{
|
|
|
|
|
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
|
|
|
|
|
CPaintDC dc(this); // device context for painting
|
|
|
|
|
OnPrepareDC(&dc);
|
|
|
|
|
OnDraw(&dc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL CDetailView::OnEraseBkgnd(CDC* pDC)
|
|
|
|
|
{
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CDetailView::OnLButtonDown(UINT nFlags, CPoint point)
|
|
|
|
|
{
|
|
|
|
|
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
|
|
|
|
|
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
|
|
|
|
int nX = point.x / ZF + pView->m_nCursor1;
|
|
|
|
|
pView->m_nCursorROI = nX;
|
|
|
|
|
pView->m_nCursorROICount = pDoc->m_nChannelCount[nX];
|
|
|
|
|
|
|
|
|
|
CPen pen;
|
|
|
|
|
CDC* pDC = GetDC();
|
|
|
|
|
pen.CreatePen(PS_SOLID, 5, RGB(255, 180, 20));
|
|
|
|
|
CPen* oldpen = pDC->SelectObject(&pen);
|
|
|
|
|
CRect rect;
|
|
|
|
|
GetClientRect(&rect);
|
|
|
|
|
pDC->SetROP2(R2_XORPEN); //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
pDC->MoveTo(point.x, 0); //<2F><><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD>
|
|
|
|
|
pDC->LineTo(point.x, rect.Height());
|
|
|
|
|
pDC->SelectObject(oldpen);
|
|
|
|
|
pen.DeleteObject();
|
|
|
|
|
|
|
|
|
|
CView::OnLButtonDown(nFlags, point);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CDetailView::OnRButtonDown(UINT nFlags, CPoint point)
|
|
|
|
|
{
|
|
|
|
|
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
|
|
|
|
|
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
|
|
|
|
pView->m_nCursor1 = 0;
|
|
|
|
|
pView->m_nCursor2 = 1023;
|
|
|
|
|
|
|
|
|
|
CView::OnRButtonDown(nFlags, point);
|
|
|
|
|
}
|