⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 childview.cpp

📁 是本人编写的串行通信的程序
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		}
		bitmapPhoto2.Attach(bmpPhoto2);
		pathFile=m_pICCardRecordSet->m_strPictureThree;        //Modify by 2003 8 8
		m_bFind=(BOOL)FindFile.FindFile(pathFile,0);
		if(m_bFind)
		{
			if(m_ReportSet->m_PhotoProject==1)
			{
				bmpPhoto3=(HBITMAP)::LoadImage(
					0,
					pathFile,
					IMAGE_BITMAP,
					ImageWidth/2-40,ImageHeight/2-30,
					LR_CREATEDIBSECTION|LR_LOADFROMFILE);
			}
			else
			{
				bmpPhoto3=(HBITMAP)::LoadImage(
					0,
					pathFile,
					IMAGE_BITMAP,
					ImageWidth,ImageHeight,
					LR_CREATEDIBSECTION|LR_LOADFROMFILE);
			}
		}
		else
		{
			bmpPhoto3=(HBITMAP)::LoadImage(
				AfxGetResourceHandle(),
				MAKEINTRESOURCE(IDB_BITMAP_PTBKCOLOR),
				IMAGE_BITMAP,0,0,
				LR_CREATEDIBSECTION|LR_LOADMAP3DCOLORS);
			ASSERT(bmpPhoto3);
		}
		bitmapPhoto3.Attach(bmpPhoto3);	
		pathFile=m_pICCardRecordSet->m_strPictureFour;        //Modify by 2003 8 8
		m_bFind=(BOOL)FindFile.FindFile(pathFile,0);
		if(m_bFind)
		{
			if(m_ReportSet->m_PhotoProject==1)
			{
				bmpPhoto4=(HBITMAP)::LoadImage(
					0,
					pathFile,
					IMAGE_BITMAP,
					ImageWidth/2-40,ImageHeight/2-30,
					LR_CREATEDIBSECTION|LR_LOADFROMFILE);
			}
			else
			{
				bmpPhoto4=(HBITMAP)::LoadImage(
					0,
					pathFile,
					IMAGE_BITMAP,
					ImageWidth,ImageHeight,
					LR_CREATEDIBSECTION|LR_LOADFROMFILE);
			}
		}
		else
		{
			bmpPhoto4=(HBITMAP)::LoadImage(
				AfxGetResourceHandle(),
				MAKEINTRESOURCE(IDB_BITMAP_PTBKCOLOR),
				IMAGE_BITMAP,0,0,
				LR_CREATEDIBSECTION|LR_LOADMAP3DCOLORS);
			ASSERT(bmpPhoto4);
		}
		bitmapPhoto4.Attach(bmpPhoto4);	
		FindFile.Close();

		CString m_strPhotoPath;
		m_strPhotoPath.Format("D:\\HelthManage\\%s\\Photo1.bmp",m_pICCardRecordSet->m_strCheckNum);
		bmpPhoto=(HBITMAP)::LoadImage(
			0,
			m_strPhotoPath,
			IMAGE_BITMAP,
			600,PhotoBottom-PhotoTop,
			LR_LOADFROMFILE|LR_CREATEDIBSECTION);
		ASSERT(bmpPhoto);
		bitmapPhoto.Attach(bmpPhoto);
		memDC.SelectObject(&bitmapPhoto);
		bitmapPhoto.GetBitmap(&structBMP);
		pDC->StretchBlt(PhotoLeft,PhotoTop,600,PhotoBottom-PhotoTop,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
		if(m_ReportSet->m_ReportStyle==1)
		{
			if(m_ReportSet->m_PhotoProject==3||m_ReportSet->m_PhotoProject==2)
			{
				CBitmap *pOldBmp = (CBitmap *)memDC.SelectObject(&bitmapPhoto1);
				bitmapPhoto1.GetBitmap( &structBMP );
				
				pDC->StretchBlt(ImageLeft,PointTop,structBMP.bmWidth,structBMP.bmHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				ImageLeft=PageWidth*3/5+80;
				ImageWidth/=2;
				ImageWidth-=40;
				ImageHeight/=2;
				ImageHeight-=30;
				memDC.SelectObject(&bitmapPhoto2);
				bitmapPhoto2.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				PointTop+=ImageHeight+60;
				memDC.SelectObject(&bitmapPhoto3);
				bitmapPhoto3.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				PointTop+=ImageHeight;
			}
			if(m_ReportSet->m_PhotoProject==1)
			{
				CBitmap *pOldBmp = (CBitmap *)memDC.SelectObject(&bitmapPhoto1);
				bitmapPhoto1.GetBitmap( &structBMP );		
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				ImageLeft=PageWidth*3/5+80;
				ImageWidth/=2;
				ImageWidth-=40;
				ImageHeight/=2;
				ImageHeight-=30;
				memDC.SelectObject(&bitmapPhoto2);
				bitmapPhoto2.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);   
				PointTop+=ImageHeight*2+60;
			}
			if(m_ReportSet->m_PhotoProject==0)
			{
				CBitmap *pOldBmp = (CBitmap *)memDC.SelectObject(&bitmapPhoto1);
				bitmapPhoto1.GetBitmap( &structBMP );
				int widthImage ,heightImage;
				widthImage=PageWidth-ImageLeft*2;
				widthImage/=5;
				widthImage*=3;
				heightImage=widthImage*3/4;
				pDC->StretchBlt(ImageLeft+widthImage/3,PointTop,widthImage,heightImage,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				PointTop+=ImageHeight;
			}
		}
		else
		{
			if(m_ReportSet->m_PhotoProject==3)
			{
				ImageLeft=PointLeft;
				ImageWidth=PageWidth-PointLeft*2;
				ImageWidth/=7;
				ImageLeft+=ImageWidth/3;
				ImageWidth*=3;
				ImageHeight=ImageWidth*3/4;		
				CBitmap *pOldBmp = (CBitmap *)memDC.SelectObject(&bitmapPhoto1);
				bitmapPhoto1.GetBitmap( &structBMP );		
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				ImageLeft=ImageLeft+ImageWidth*8/7;
				memDC.SelectObject(&bitmapPhoto2);
				bitmapPhoto2.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				PointTop+=ImageHeight+10;
				ImageLeft-=ImageWidth*8/7;
				memDC.SelectObject(&bitmapPhoto3);
				bitmapPhoto3.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				ImageLeft+=ImageWidth*8/7;
				memDC.SelectObject(&bitmapPhoto4);
				bitmapPhoto4.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				PointTop+=ImageHeight;
			}
			if(m_ReportSet->m_PhotoProject==2)
			{
				ImageLeft=20;
				ImageWidth=PageWidth-60;
				ImageWidth/=3;
				ImageHeight=ImageWidth*3/4;
				CBitmap *pOldBmp = (CBitmap *)memDC.SelectObject(&bitmapPhoto1);
				bitmapPhoto1.GetBitmap( &structBMP );		
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				ImageLeft=ImageLeft+ImageWidth+10;
				memDC.SelectObject(&bitmapPhoto2);
				bitmapPhoto2.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);  
				ImageLeft+=ImageWidth+10;
				memDC.SelectObject(&bitmapPhoto3);
				bitmapPhoto3.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				PointTop+=ImageHeight;
			}
			if(m_ReportSet->m_PhotoProject==1)
			{
				ImageLeft=PointLeft;
				ImageWidth=PageWidth-PointLeft*2-20;
				ImageWidth/=2;
				ImageHeight=ImageWidth*3/4;
				CBitmap *pOldBmp = (CBitmap *)memDC.SelectObject(&bitmapPhoto1);
				bitmapPhoto1.GetBitmap( &structBMP );		
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				ImageLeft=ImageLeft+ImageWidth+20;
				memDC.SelectObject(&bitmapPhoto2);
				bitmapPhoto2.GetBitmap(&structBMP);
				pDC->StretchBlt(ImageLeft,PointTop,ImageWidth,ImageHeight,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);  
				
				PointTop+=ImageHeight;
			}
			if(m_ReportSet->m_PhotoProject==0)
			{
				CBitmap *pOldBmp = (CBitmap *)memDC.SelectObject(&bitmapPhoto1);
				bitmapPhoto1.GetBitmap( &structBMP );
				int widthImage ,heightImage;
				widthImage=PageWidth-ImageLeft*2;
				widthImage/=5;
				widthImage*=3;
				heightImage=widthImage*3/4;
				pDC->StretchBlt(ImageLeft+widthImage/3,PointTop,widthImage,heightImage,&memDC,0,0,structBMP.bmWidth,structBMP.bmHeight,SRCCOPY);
				PointTop+=ImageHeight;
			}
		}
		PointTop+=10;
		pDC->MoveTo(0,PointTop);
		pDC->LineTo(PageWidth,PointTop);
		PointTop+=FontSize.cy;
		ItemName="图象所见:";
		pDC->TextOut(PointLeft,PointTop,ItemName);
		int CheckWidth,CheckHeight;
		CheckWidth=PageWidth-PointLeft;
		CheckHeight=PageHeight-PointTop;
		CheckHeight/=2;
		CheckHeight+=PointTop;
		CRect rectView(PointLeft+FontSize.cx,PointTop+FontSize.cy,CheckWidth,CheckHeight);
		pDC->SelectObject(&ItemFont);
		pDC->DrawText(m_pICCardRecordSet->m_strPictureOfSee,&rectView,DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);
		ItemName="诊断意见:";
		pDC->SelectObject(&ItemNameFont);
		PointTop=CheckHeight+FontSize.cy;
		pDC->TextOut(PointLeft,PointTop,ItemName);
		pDC->SelectObject(&ItemFont);
		PointTop+=FontSize.cy*2;
		CheckHeight=PointTop+FontSize.cy*5;
		rectView.top=PointTop;
		rectView.bottom=CheckHeight;
		pDC->DrawText(m_pICCardRecordSet->m_strClinMind,&rectView,DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);
		pDC->SelectObject(&ItemNameFont);
		ItemName="检查医师:";
		PointTop=CheckHeight+FontSize.cy;
		pDC->TextOut(PointLeft,PointTop,ItemName);
		ItemName=m_pICCardRecordSet->m_strCheckDoctor;
		pDC->TextOut(PointLeft+FontSize.cx,PointTop,ItemName);
/*		ItemName="本报告仅供临床医师参考,不作任何证明用";
		pDC->TextOut(PointLeft+FontSize.cx*3,PointTop,ItemName);
		PointTop+=FontSize.cy+20;
		pDC->MoveTo(0,PointTop);
		pDC->LineTo(PageWidth,PointTop);
		ItemName="医院地址:";
		pDC->SelectObject(&ItemFont);
		PointTop+=20;
		pDC->TextOut(PointLeft,PointTop,ItemName);
		pDC->TextOut(PointLeft+FontSize.cx,PointTop,m_ReportSet->m_HospitalAddress);
		ItemName="联系电话:";
		pDC->TextOut(PointLeft+FontSize.cx*5,PointTop,ItemName);
		pDC->TextOut(PointLeft+FontSize.cx*6,PointTop,m_ReportSet->m_Telephone);
		}
		else
		{
		SQL.Format("检查号='%s'",m_B);         //Modify by 2003 8 8
		m_pUltraPatientSet->m_strFilter=SQL;
		m_pUltraPatientSet->Requery();
		if(!m_ReportSet->IsBOF())
			m_ReportSet->MoveFirst();
		
		CString ReportDataTime=m_pUltraPatientSet->m_CheckData;
		m_ReportSet->Requery();
		int PageWidth,PageHeight,PageLeft,PageTop;
		PageWidth=pInfo->m_rectDraw.right;
		PageHeight=pInfo->m_rectDraw.bottom;
		PageLeft=pInfo->m_rectDraw.left;
		PageTop=pInfo->m_rectDraw.top;
		LOGFONT lf;
		COLORREF clrRef;
		memset(&lf, 0, sizeof(LOGFONT));       // clear out structure.
		lf.lfHeight = m_ReportSet->m_HospitalFont;	// request a 12-pixel-height font
		lf.lfWidth = 0;
		lf.lfEscapement=0;
		lf.lfOrientation = 0;
		lf.lfWeight = FW_BOLD;//FW_THIN/FW_LIGHT/FW_NORMAL/FW_BOLD/FW_EXTRABOLD/FW_HEAVY/FW_DONTCARE(0)
		lf.lfItalic = 0;
		lf.lfUnderline = 0;
		lf.lfStrikeOut = 0;
		lf.lfCharSet =	DEFAULT_CHARSET;	//CHINESEBIG5_CHARSET/DEFAULT_CHARSET/GB2312_CHARSET/ANSI_CHARSET
		lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
		lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
		lf.lfQuality = DEFAULT_QUALITY;
		lf.lfPitchAndFamily = FF_DONTCARE;
		strcpy(lf.lfFaceName, "隶书");   // request a face name "Arial".
		CFont HospitalFont,ReportNameFont,ItemNameFont,ItemFont;
		CPen m_pen;
		VERIFY(HospitalFont.CreatePointFontIndirect(&lf, pDC));	//is measured in tenths of a point rather than logical units. 
		strcpy(lf.lfFaceName,"隶书");
		lf.lfHeight=m_ReportSet->m_ReportFont;
		lf.lfWeight=FW_BOLD;
		VERIFY(ReportNameFont.CreatePointFontIndirect(&lf,pDC));
		
		strcpy(lf.lfFaceName,"黑体");
		lf.lfHeight=m_ReportSet->m_CharactorFont;
		lf.lfWeight=FW_NORMAL;
		VERIFY(ItemNameFont.CreatePointFontIndirect(&lf,pDC));
		
		strcpy(lf.lfFaceName,"宋体");
		lf.lfHeight=m_ReportSet->m_Charactor;
		lf.lfWeight=FW_NORMAL;
		VERIFY(ItemFont.CreatePointFontIndirect(&lf,pDC));
		pDC->SelectObject(&HospitalFont);
		pDC->SetTextAlign(TA_LEFT);
		NameText=m_ReportSet->m_BigTitle;
		CSize FontSize;
		FontSize=pDC->GetTextExtent(NameText);
		int titleLeft=PageWidth-FontSize.cx;
		titleLeft/=2;
		pDC->TextOut(titleLeft,140,NameText);
		int PointTop=PageTop+140+FontSize.cy;
		PointTop+=40;
		pDC->SelectObject(&ReportNameFont);
		NameText=m_ReportSet->m_LittleTitle1;	
		FontSize=pDC->GetTextExtent(NameText);
		titleLeft=PageWidth-FontSize.cx;
		titleLeft/=2;
		pDC->TextOut(titleLeft,PointTop,NameText);
		
		CBitmap m_pBitmap;
		HBITMAP bmpFlag;
		bmpFlag=(HBITMAP)::LoadImage(
			0,
			"TitleBmp.bmp",
			IMAGE_BITMAP,
			0,0,
			LR_CREATEDIBSECTION|LR_LOADFROMFILE);
		m_pBitmap.Attach(bmpFlag);
		BITMAP m_StructTitle;
		m_pBitmap.GetBitmap(&m_StructTitle);
		CDC memDC;
		memDC.CreateCompatibleDC(pDC);
		memDC.SelectObject(&m_pBitmap);
		pDC->SetStretchBltMode(COLORONCOLOR);//you must use this mode style ,or the printpreview picture can changing 
		pDC->StretchBlt(PageWidth/5,PointTop-FontSize.cy-60,PageWidth/10,PageWidth/10,&memDC,0,0,m_StructTitle.bmWidth,m_StructTitle.bmHeight,SRCCOPY);
		
		PointTop=PointTop+FontSize.cy;
		clrRef=0x0000000000;
		m_pen.CreatePen(PS_SOLID,6,clrRef);
		pDC->SelectObject(&m_pen);
		PointTop+=70;
		PhotoTop=PointTop;
		pDC->MoveTo(0,PointTop);
		pDC->LineTo(PageWidth,PointTop);
		CString ItemName="姓名:";
		PointTop+=80;
		int PointLeft=PageLeft+150;
		int ItemWidth=PageWidth-PointLeft*3;
		ItemWidth/=3;
		PhotoLeft=ItemWidth*3-360;
		PhotoRight=PhotoLeft+PointLeft+360;
		pDC->SelectObject(&ItemNameFont);	
		FontSize=pDC->GetTextExtent(ItemName);
		pDC->TextOut(PointLeft,PointTop,ItemName);
		CRect ItemRect(PointLeft+FontSize.cx,PointTop,ItemWidth+PointLeft,PointTop+FontSize.cy);
		pDC->SelectObject(&ItemFont);
		pDC->DrawText(m_pUltraPatientSet->m_Name,&ItemRect,DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);
		ItemName="性别:";
		pDC->SelectObject(&ItemNameFont);
		pDC->TextOut(ItemWidth+PointLeft,PointTop,ItemName);
		pDC->SelectObject(&ItemFont);
		ItemRect.left=ItemWidth+FontSize.cx+PointLeft;
		ItemRect.right=ItemWidth*2+PointLeft;
		pDC->DrawText(m_pUltraPatientSet->m_Sex,&ItemRect,DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);
		ItemName="年龄:";
		pDC->SelectObject(&ItemNameFont);
		pDC->TextOut(ItemWidth*2+PointLeft,PointTop,ItemName);
		ItemRect.left=ItemWidth*2+FontSize.cx+PointLeft;
		ItemRect.right=ItemWidth*3+PointLeft;
		pDC->SelectObject(&ItemFont);
		CString m_strAge;
		m_strAge.Format("%d",m_pICCardRecordSet->m_Age);
		pDC->DrawText(m_strAge,&ItemRect,DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);

		ItemWidth=PageWidth-PointLeft*3;
		ItemWidth/=3;
		ItemName="检查号:";
		pDC->SelectObject(&ItemNameFont);
		PointTop+=FontSize.cy*3;
		pDC->TextOut(PointLeft,PointTop,ItemName);
		FontSize=pDC->GetTextExtent(ItemName);
		ItemRect.left=PointLeft+FontSize.cx;
		ItemRect.right=ItemWidth+PointLeft;
		ItemRect.top=PointTop;
		ItemRect.bottom=PointTop+FontSize.cy;
		pDC->SelectObject(&ItemFont);
		pDC->DrawText(m_pUltraPatientSet->m_CheckNum,&ItemRect,DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);
		ItemName="床位号:";
		pDC->SelectObject(&ItemNameFont);
		pDC->TextOut(ItemWidth+PointLeft,PointTop,ItemName);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -