Files
geomative/GeomativeStudio/cpp/Views/opcreatesptinfoview.cpp
T
coco df489d5640 a
2026-07-03 16:05:30 +08:00

274 lines
6.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// opcreatesptinfoview.cpp : implementation file
//
#include "stdafx.h"
#include "geomative.h"
#include "opcreatesptinfoview.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COpCreateSptInfoView
IMPLEMENT_DYNCREATE(COpCreateSptInfoView, CView)
COpCreateSptInfoView::COpCreateSptInfoView()
{
m_bIsDraw = FALSE;
m_pCurSptRecord = NULL;
}
COpCreateSptInfoView::~COpCreateSptInfoView()
{
}
BEGIN_MESSAGE_MAP(COpCreateSptInfoView, CView)
//{{AFX_MSG_MAP(COpCreateSptInfoView)
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COpCreateSptInfoView drawing
void COpCreateSptInfoView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
CString szLabel = _T("");
CString szValue = _T("");
int iRecIndex = (int)VAL_ZERO;
int iRecCount = (int)VAL_ZERO;
CDC* pMemDC = new CDC;
CBitmap* pMemBmp = new CBitmap;
CBitmap* pOldMemBmp = NULL;
CRect rectMemBmp;
CRect rectView;
int iMaxViewWidth = (int)VAL_ZERO;
int iMaxViewHeight = (int)VAL_ZERO;
CFont ftInfo;
CFont* pOldFtInfo = NULL;
this->GetClientRect(&rectView);
if ((NULL != m_pNewChannel) && (TRUE == m_bIsDraw))
{
iRecCount = m_pNewChannel->m_sptRecArray.GetSize();
if (iRecCount > 0)
{
rectMemBmp.left = (long)VAL_ZERO;
rectMemBmp.top = (long)VAL_ZERO;
rectMemBmp.right = rectView.right;
rectMemBmp.bottom = rectView.bottom;
iMaxViewWidth = rectMemBmp.right-rectMemBmp.left;
iMaxViewHeight = rectMemBmp.bottom-rectMemBmp.top;
pMemDC->CreateCompatibleDC(pDC);
pMemBmp->CreateCompatibleBitmap(pDC, iMaxViewWidth, iMaxViewHeight);
pOldMemBmp = pMemDC->SelectObject(pMemBmp);
pMemDC->FillSolidRect(rectView, RGB(255,255,255));
pMemDC->SetBkMode(TRANSPARENT);
pMemDC->Rectangle(10, 10, 300, 230);
ftInfo.CreatePointFont(95, _T("Tahoma"));
pOldFtInfo = pMemDC->SelectObject(&ftInfo);
szLabel.Empty();
szLabel.LoadString(IDS_TPAMOUNT);
szValue.Empty();
szValue.Format(_T("%d"), this->m_pNewChannel->m_iPtAmount);
szLabel += szValue;
pMemDC->TextOut(100, 20, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_MAXLEVEL);
szValue.Empty();
szValue.Format(_T("%d"), this->m_pNewChannel->m_iMaxLevel);
szLabel += szValue;
pMemDC->TextOut(100, 40, szLabel);
pMemDC->MoveTo(10, 60);
pMemDC->LineTo(300, 60);
if (NULL != this->m_pCurSptRecord)
{
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_C1);
szValue.Empty();
szValue.Format(_T("%d"), m_pCurSptRecord->m_iC1);
szLabel += szValue;
pMemDC->TextOut(100, 80, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_C2);
szValue.Empty();
szValue.Format(_T("%d"), m_pCurSptRecord->m_iC2);
szLabel += szValue;
pMemDC->TextOut(100, 100, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_P1);
szValue.Empty();
szValue.Format(_T("%d"), m_pCurSptRecord->m_iP1);
szLabel += szValue;
pMemDC->TextOut(100, 120, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_P2);
szValue.Empty();
szValue.Format(_T("%d"), m_pCurSptRecord->m_iP2);
szLabel += szValue;
pMemDC->TextOut(100, 140, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_K);
szValue.Empty();
szValue.Format(_T("%f"), m_pCurSptRecord->m_fK);
szLabel += szValue;
pMemDC->TextOut(100, 160, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_N);
szValue.Empty();
szValue.Format(_T("%d"), m_pCurSptRecord->m_iN);
szLabel += szValue;
pMemDC->TextOut(100, 180, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_LEVEL);
szValue.Empty();
szValue.Format(_T("%d"), m_pCurSptRecord->m_iLevel);
szLabel += szValue;
pMemDC->TextOut(100, 200, szLabel);
}
else
{
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_C1);
szValue.Empty();
szValue.Format(_T("%d"), (int)VAL_ZERO);
szLabel += szValue;
pMemDC->TextOut(100, 80, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_C2);
szValue.Empty();
szValue.Format(_T("%d"), (int)VAL_ZERO);
szLabel += szValue;
pMemDC->TextOut(100, 100, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_P1);
szValue.Empty();
szValue.Format(_T("%d"), (int)VAL_ZERO);
szLabel += szValue;
pMemDC->TextOut(100, 120, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_P2);
szValue.Empty();
szValue.Format(_T("%d"), (int)VAL_ZERO);
szLabel += szValue;
pMemDC->TextOut(100, 140, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_K);
szValue.Empty();
szValue.Format(_T("%f"), (float)VAL_ZERO);
szLabel += szValue;
pMemDC->TextOut(100, 160, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_N);
szValue.Empty();
szValue.Format(_T("%d"), (int)VAL_ZERO);
szLabel += szValue;
pMemDC->TextOut(100, 180, szLabel);
szLabel.Empty();
szLabel.LoadString(IDS_DB_SCRIPT_LEVEL);
szValue.Empty();
szValue.Format(_T("%d"), (int)VAL_ZERO);
szLabel += szValue;
pMemDC->TextOut(100, 200, szLabel);
}
pDC->BitBlt((int)VAL_ZERO, (int)VAL_ZERO, iMaxViewWidth, iMaxViewHeight, pMemDC, (int)VAL_ZERO, (int)VAL_ZERO, SRCCOPY);
ftInfo.DeleteObject();
pMemDC->SelectObject(pOldFtInfo);
pMemDC->SelectObject(pOldMemBmp);
pMemBmp->DeleteObject();
pMemDC->DeleteDC();
delete pMemBmp;
delete pMemDC;
}
}
else
{
pDC->FillSolidRect((int)VAL_ZERO, (int)VAL_ZERO, rectView.Width(), rectView.Height(), RGB(255,255,255));
}
}
/////////////////////////////////////////////////////////////////////////////
// COpCreateSptInfoView diagnostics
#ifdef _DEBUG
void COpCreateSptInfoView::AssertValid() const
{
CView::AssertValid();
}
void COpCreateSptInfoView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// COpCreateSptInfoView message handlers
BOOL COpCreateSptInfoView::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return TRUE;
// return CView::OnEraseBkgnd(pDC);
}