📄 skinview.cpp
字号:
GetClientRect( &Client);
if(!bChartCreat)
pChart->Create("Chart", WS_CHILD, Client, this, ID_GRAPH);
pChart->SetType(25313288L);
pChart->SetPointType(0);
pChart->SetTitle(0, "增产率");
pChart->SetTitle(2, "表皮系数降低值与增产率关系曲线");
pChart->SetTitle(3, "表皮系数降低值");
pChart->SetFonts(0, 10L); // 纵轴字体
pChart->SetFonts(2, 12L); // 标题字体
pChart->SetFonts(3, 10L); // 横轴字体
pChart->SetEnabled(FALSE);
bChartCreat = TRUE;
if(!bReportCreat)
{
// CDC* pDC=GetDC();
// myfont.CreatePointFont(160, "System", pDC); // 屏幕显示
// ReleaseDC(pDC);
pReport1->Create("report1", WS_CHILD, Client, this, ID_REPORT1);
pReport2->Create("report2", WS_CHILD, Client, this, ID_REPORT2);
}
bReportCreat=TRUE;
}
void CMyView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
// TODO: Add your specialized code here and/or call the base class
CMyDoc* pDoc = GetDocument();
int width=0;
int height=0; // 字符行高
CRect textRect = pInfo->m_rectDraw;
CRect GraphRect = pDoc->GraphRect;
CRect PrintRect = pInfo->m_rectDraw;
// 建立字体
myfont1 = new CFont;
myfont2 = new CFont;
myfont1->CreatePointFont(100, "System", pDC); // 屏幕显示
myfont2->CreatePointFont(160, "黑体", pDC); // 屏幕显示
if(!bPrintReport)
{
CFont *poldFont = pDC->SelectObject(myfont1);
// pDC->SetMapMode(MM_LOMETRIC);
pDC->LPtoDP(GraphRect);
if(GraphRect.bottom < 0) GraphRect.bottom *= -1;
if(GraphRect.top < 0) GraphRect.top *= -1;
// pDC->SetMapMode(MM_TEXT);
if(pDoc->OPER==ZENGCHAN)
{
if(pInfo->m_bPreview)
{ // 打印预览
pDC->OffsetViewportOrg(GraphRect.left, GraphRect.top);
pChart->Paint((long)pDC->m_hDC, 0, 0,
GraphRect.right-GraphRect.left, (GraphRect.bottom-GraphRect.top),
TRUE, 0);
pDC->OffsetViewportOrg(-GraphRect.left, -GraphRect.top);
}
else
{
pChart->Paint((long)pDC->m_hDC, GraphRect.left, GraphRect.top,
GraphRect.right, GraphRect.bottom,
TRUE, 0);
}
}
if(pDoc->OPER==BIAOPI || pDoc->OPER == SHENDU)
{
pChart->ShowWindow(SW_HIDE);
str1.Format("总表皮系数 = %-10.4lf\n", pDoc->s);
str2.Format("部分打开地层表皮系数 = %-10.4lf, 射孔表皮系数 = %-10.4lf",
pDoc->spt, pDoc->spf);
str3.Format(" 非达西流表皮系数 = %-10.4lf, 地层边界形状表皮系数 = %-10.4lf",
pDoc->snd,pDoc->sca);
str4.Format(" 一条边界表皮系数 = %-10.4lf, 两条边界表皮系数 = %-10.4lf",
pDoc->s1b, pDoc->s2b);
str5.Format(" 相变表皮系数 = %-10.4lf, 井斜表皮系数 = %-10.4lf",
pDoc->scp, pDoc->sws);
str6.Format(" 各向异性表皮系数 = %-10.4lf, 变产量表皮系数 = %-10.4lf",
pDoc->san, pDoc->svq);
str7.Format(" 地层损害表皮系数 = %10.4lf, 压力敏感表皮系数 = %-10.4lf",
pDoc->sd,pDoc->sym);
TEXTMETRIC mytext;
pDC->GetTextMetrics( &mytext);
pDC->DPtoLP(textRect);
height = mytext.tmHeight *2;
textRect.top = 60;
pDC->DrawText(str1, -1, textRect, DT_CENTER | DT_SINGLELINE);
textRect.top += height;
pDC->DrawText(str2, -1, textRect, DT_CENTER | DT_SINGLELINE);
textRect.top += height;
pDC->DrawText(str3, -1, textRect, DT_CENTER | DT_SINGLELINE);
textRect.top += height;
pDC->DrawText(str4, -1, textRect, DT_CENTER | DT_SINGLELINE);
textRect.top += height;
pDC->DrawText(str5, -1, textRect, DT_CENTER | DT_SINGLELINE);
textRect.top += height;
pDC->DrawText(str6, -1, textRect, DT_CENTER | DT_SINGLELINE);
textRect.top += height;
pDC->DrawText(str7, -1, textRect, DT_CENTER | DT_SINGLELINE);
}
if(pDoc->OPER == SHENDU)
{
str1.Format("损害深度 = %-10.4lf(m)",pDoc->fls);
textRect.top += (long) height*1.5;
pDC->DrawText(str1, -1, textRect, DT_CENTER | DT_SINGLELINE);
}
bPrint = TRUE;
pDC->SelectObject(poldFont);
}
else // 打印报告
{
CFont *pOldFont = pDC->SelectObject( myfont2);
CString str;
// pDC->OffsetViewportOrg(PrintRect.left, PrintRect.top);
TEXTMETRIC mytext;
pDC->GetTextMetrics( &mytext);
height = mytext.tmHeight ;
PrintRect.left = height * 5; // 左边缩进
PrintRect.top = height * 4; // 右边缩进
pDC->TextOut(PrintRect.left, PrintRect.top, "二. 评价报告");
pDC->SelectObject( myfont1);
PrintRect.top += height*2;
str.Format("1. 总表皮系数 = %-10.4lf", pDoc->s);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
str.Format("2. 分解表皮系数");
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
PrintRect.left += height*3; // 向右缩进
str.Format(" 部分打开表皮系数 = %-10.4lf, 射孔表皮系数 = %-10.4lf",
pDoc->spt, pDoc->spf);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
str.Format(" 非达西流表皮系数 = %-10.4lf, 地层边界形状表皮系数 = %-10.4lf",
pDoc->snd,pDoc->sca);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
str.Format(" 一条边界表皮系数 = %-10.4lf, 两条边界表皮系数 = %-10.4lf",
pDoc->s1b, pDoc->s2b);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
str.Format(" 相变表皮系数 = %-10.4lf, 井斜表皮系数 = %-10.4lf",
pDoc->scp, pDoc->sws);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
str.Format(" 各向异性表皮系数 = %-10.4lf, 变产量表皮系数 = %-10.4lf",
pDoc->san, pDoc->svq);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
str.Format(" 地层损害表皮系数 = %10.4lf, 压力敏感表皮系数 = %-10.4lf",
pDoc->sd,pDoc->sym);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
PrintRect.left -= height*3; // 向右缩进还原
str.Format("3. 地层损害深度 = %10.4lfm", pDoc->fls);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
str.Format("4. 完全消除地层损害表皮系数后增产率为 = %-7.2lf",pDoc->dpr0);
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height;
//结论
if( pDoc->sd >= 10 || pDoc->dpr0 >= 1)
str.Format("5. 结论:该层受到严重损害,建议实行大型增产措施");
else if((pDoc->sd < 5 && pDoc->sd >= 1) || ( pDoc->dpr0 < 1 && pDoc->dpr0 >= 0.2))
str.Format("5. 结论:该层受到较严重损害,建议实行增产措施");
else if((pDoc->sd < 2 && pDoc->sd >= 0) || ( pDoc->dpr0 < 0.2 && pDoc->dpr0 >= 0.0))
str.Format("5. 结论:轻微损害");
else
str.Format("5. 结论:无损害");
pDC->DrawText(str, -1, PrintRect, DT_SINGLELINE);
PrintRect.top += height*3;
pDC->SelectObject( myfont2);
pDC->TextOut(PrintRect.left, PrintRect.top, "三. 附图");
pDC->SelectObject(pOldFont);
pChart->Paint((long)pDC->m_hDC,
PrintRect.left+(PrintRect.right-PrintRect.left)/8,
PrintRect.top+100,
PrintRect.right-(PrintRect.right-PrintRect.left)/8,
PrintRect.bottom/3+PrintRect.top, // 页面上三分之一的区域
TRUE, 0);
}
delete myfont1;
delete myfont2;
// CView::OnPrint(pDC, pInfo);
}
void CMyView::OnFilePrintReport()
{
// TODO: Add your command handler code here
short filetype = F1FileFormulaOne3;
bPrintReport = TRUE;
pReport1->Read(ReportName, &filetype);
pReport1->ShowWindow(SW_SHOW);
SetReport1Value();
pReport1->SetPrintArea("A1:E36");
pReport1->FilePrint(TRUE);
CView::OnFilePrint();
bPrintReport = FALSE;
}
void CMyView::SetReport1Value()
{
CMyDoc* pDoc = GetDocument();
int bn = 1; // 起始行数
// 井名
CString name;
name.Format("%s", pDoc->Wellname);
pReport1->SetTextRC(1, 3, name);
pReport1->SetTextRC(bn+1, 3, "储层损害评价报告");
// 地层参数
pReport1->SetNumberRC(bn+4, 3, pDoc->ca);
if(pDoc->n1b) // 无边界时不显示边界值
pReport1->SetNumberRC(bn+5, 3, pDoc->dwtob1);
pReport1->SetNumberRC(bn+6, 3, pDoc->hkx);
pReport1->SetNumberRC(bn+7, 3, pDoc->vk);
pReport1->SetNumberRC(bn+8, 3, pDoc->h);
pReport1->SetNumberRC(bn+9, 3, pDoc->ct);
pReport1->SetNumberRC(bn+4, 5, pDoc->phi);
if(pDoc->n2b) // 无边界时不显示边界值
pReport1->SetNumberRC(bn+5, 5, pDoc->dwtob2);
pReport1->SetNumberRC(bn+6, 5, pDoc->hky);
pReport1->SetNumberRC(bn+7, 5, pDoc->hkout);
pReport1->SetNumberRC(bn+8, 5, pDoc->hp);
pReport1->SetNumberRC(bn+9, 5, pDoc->alf);
//生产参数
pReport1->SetNumberRC(bn+11, 3, pDoc->tp);
pReport1->SetNumberRC(bn+12, 3, pDoc->pi);
pReport1->SetNumberRC(bn+13, 3, pDoc->hnslop);
if(pDoc->nvq == 0)
pReport1->SetNumberRC(bn+11, 5, pDoc->qc);
pReport1->SetNumberRC(bn+12, 5, pDoc->pwf);
//井身参数
pReport1->SetNumberRC(bn+15, 3, pDoc->wsl);
pReport1->SetNumberRC(bn+16, 3, pDoc->rw);
pReport1->SetNumberRC(bn+17, 3, pDoc->rkfpc);
pReport1->SetNumberRC(bn+15, 5, pDoc->s);
pReport1->SetNumberRC(bn+16, 5, pDoc->rb);
//流体参数
pReport1->SetNumberRC(bn+19, 3, pDoc->rhls);
pReport1->SetNumberRC(bn+20, 3, pDoc->bfv);
pReport1->SetNumberRC(bn+21, 3, pDoc->d);
pReport1->SetNumberRC(bn+19, 5, pDoc->vis);
pReport1->SetNumberRC(bn+20, 5, pDoc->belt);
//射孔参数
pReport1->SetNumberRC(bn+23, 3, pDoc->n);
pReport1->SetNumberRC(bn+24, 3, pDoc->flp);
pReport1->SetNumberRC(bn+25, 3, pDoc->gk);
pReport1->SetNumberRC(bn+23, 5, pDoc->lphi);
pReport1->SetNumberRC(bn+24, 5, pDoc->rp);
for(int i=1; i<=pDoc->nq; i++)
{
pReport1->SetNumberRC(bn+28+i, 2, pDoc->t[i]);
pReport1->SetNumberRC(bn+28+i, 4, pDoc->q[i]);
}
}
void CMyView::SetReport2Value()
{
CMyDoc* pDoc = GetDocument();
//总表皮系数
pReport1->SetNumberRC(2, 3, pDoc->s);
//分解表皮系数
pReport1->SetNumberRC(4, 3, pDoc->spt);
pReport1->SetNumberRC(5, 3, pDoc->snd);
pReport1->SetNumberRC(6, 3, pDoc->s1b);
pReport1->SetNumberRC(7, 3, pDoc->scp);
pReport1->SetNumberRC(8, 3, pDoc->san);
pReport1->SetNumberRC(9, 3, pDoc->sd);
pReport1->SetNumberRC(4, 5, pDoc->spf);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -