void CTestView::OnDraw(CDC* pDC)
{
CTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CDC mDC;
CBitmap mBit,OldBit;
BITMAP bm;
static int w = 100;
CString Txt;
// 显示CODE128码
Txt.Format("Code 128 %d",w);
mBit.Attach(MakeBarCode(3,Txt,3,0,100,180));
mBit.GetObject(sizeof BITMAP,&bm);
mDC.CreateCompatibleDC(pDC);
OldBit.Attach(mDC.SelectObject(&mBit));
pDC->TextOut(100,10,"CODE 128码");
pDC->BitBlt(100,30,bm.bmWidth,bm.bmHeight ,&mDC,0,0,SRCCOPY);
pDC->TextOut(100,140,Txt);
// 显示CODE39码
mBit.DeleteObject();
Txt.Format("CODE 39 %d",w);
mBit.Attach(MakeBarCode(1,Txt,2,6,100,0));
mBit.GetObject(sizeof BITMAP,&bm);
mDC.SelectObject(&mBit);
pDC->TextOut(100,210,"CODE 39码");
pDC->BitBlt(100,230,bm.bmWidth,bm.bmHeight ,&mDC,0,0,SRCCOPY);
pDC->TextOut(100,340,Txt);
mDC.SelectObject(&OldBit);
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。