有谁知道哪儿有图象大的原码放??????新手请教,,谢谢了 有谁知道哪儿有图象大的原码放????新手请教,,谢谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 兄弟你读了bmp数据后,把横向和纵向的象素都重写就加倍了 //单文档//1.在CzoomView类的头文件中增加protected: CSize m_sizeDest; CSize m_sizeSource; CBitmap * m_pBitmap; CDC * m_pdcMem; int oldx,oldy,s,d; //s确定被放大区域,d确定放大显示区域,放大倍率=d/s bool recover; long mana;//2.在资源中加入一个位图 ID设为IDB_BITMAP1//3.CZoomPartView::CZoomPartView(){ // TODO: add construction code here m_pdcMem = new CDC; m_pBitmap = new CBitmap; recover = true; s = 30; d = 45; mana = SRCCOPY;}CZoomPartView::~CZoomPartView(){ delete m_pdcMem; delete m_pBitmap;}void CZoomPartView::OnDraw(CDC* pDC){ CZoomPartDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here //声明判断是否load位图的静态标志 static bool load; //按原来大小显示位图 if (!load) { BITMAP bm; load = !load; m_pBitmap->LoadBitmap(IDB_BITMAP1); m_pdcMem->CreateCompatibleDC(pDC); m_pdcMem->SelectObject(m_pBitmap); m_pBitmap->GetObject(sizeof(bm),&bm); m_sizeSource.cx = bm.bmWidth; m_sizeSource.cy = bm.bmHeight; m_sizeDest = m_sizeSource; pDC->StretchBlt(0,0,m_sizeSource.cx,m_sizeSource.cy, m_pdcMem,0,0,m_sizeSource.cx,m_sizeSource.cy,mana); } else { pDC->StretchBlt(0,0,m_sizeSource.cx,m_sizeSource.cy, m_pdcMem,0,0,m_sizeSource.cx,m_sizeSource.cy,mana);}}//在CzoomView 类中,用ClassWizard 响应WM_MOUSEMOVE消息 void CZoomPartView::OnMouseMove(UINT nFlags, CPoint point) { //计算要放大的局部矩形的源图像位置和目标位置 CString cord; int dd; CRect srect,drect,mrect; srect.left = point.x - s; srect.top = point.y - s; srect.right = point.x + s; srect.bottom = point.y + s; drect.left = point.x - d; drect.top = point.y - d; drect.right = point.x + d; drect.bottom = point.y + d; mrect.left = oldx - d; mrect.top = oldy - d; mrect.right = oldx + d; mrect.bottom = oldy + d; dd = 2*d; CDC * pDC = GetDC(); OnPrepareDC(pDC); //放大图像 if (recover) { pDC->BitBlt(mrect.left,mrect.top,dd,dd, m_pdcMem,mrect.left,mrect.top,mana); } pDC->StretchBlt(drect.left,drect.top, drect.Width(),drect.Height(),m_pdcMem,srect.left, srect.top,srect.Width(),srect.Height(),SRCCOPY); oldx = point.x; oldy = point.y; ReleaseDC(pDC); recover = true; CView::OnMouseMove(nFlags, point);}//同样 响应鼠标按下的消息void CZoomPartView::OnLButtonDown(UINT nFlags, CPoint point) { //如果鼠标位置不在位图上,则还原位图大小显示 CRect rc(0,0,m_sizeSource.cx,m_sizeSource.cy); if(!rc.PtInRect(point)) { Invalidate(); } else if (d > 5)//如果放大倍数大于5,就继续减小放大倍数,然后进行放大显示 { CDC * pDC = GetDC(); pDC->StretchBlt(oldx - d,oldy - d,2*d, 2*d,m_pdcMem,oldx - d,oldy - d,2*d,2*d,mana); d -= 10; ReleaseDC(pDC); CZoomPartView::OnMouseMove(nFlags, point); } CView::OnLButtonDown(nFlags, point);}//编译运行 StrechBlt或者使用XFORM(查查MSDN就知道了)可作自有变化或者自己写(使用反向变换,插值确定位图数据) 想用vc实现一个图像的交互,需要那些知识 用vba怎么取得 word 中一行文字的高度(用像素表示)? 如何使用Invoke函数? VC如何打开一个硬盘上的文件 直接用Rectangle画矩形为何出现两个矩形了? 关闭窗口的问题 多文件下载遇到的问题??大家帮忙看看!!谢谢! 线程函数中如何调用类中的其他成员函数?? 发群体邮件 怎么发? 能拿走的一分也别留下!! 软件界面开发套餐在CSDN被发表 急问:关于UDP包不能接受的问题
//1.在CzoomView类的头文件中增加protected:
CSize m_sizeDest;
CSize m_sizeSource;
CBitmap * m_pBitmap;
CDC * m_pdcMem;
int oldx,oldy,s,d; //s确定被放大区域,d确定放大显示区域,放大倍率=d/s
bool recover;
long mana;//2.在资源中加入一个位图 ID设为IDB_BITMAP1
//3.
CZoomPartView::CZoomPartView()
{
// TODO: add construction code here
m_pdcMem = new CDC;
m_pBitmap = new CBitmap;
recover = true;
s = 30; d = 45;
mana = SRCCOPY;}
CZoomPartView::~CZoomPartView()
{
delete m_pdcMem;
delete m_pBitmap;
}void CZoomPartView::OnDraw(CDC* pDC)
{
CZoomPartDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here //声明判断是否load位图的静态标志
static bool load;
//按原来大小显示位图
if (!load) {
BITMAP bm;
load = !load;
m_pBitmap->LoadBitmap(IDB_BITMAP1);
m_pdcMem->CreateCompatibleDC(pDC);
m_pdcMem->SelectObject(m_pBitmap);
m_pBitmap->GetObject(sizeof(bm),&bm);
m_sizeSource.cx = bm.bmWidth;
m_sizeSource.cy = bm.bmHeight;
m_sizeDest = m_sizeSource;
pDC->StretchBlt(0,0,m_sizeSource.cx,m_sizeSource.cy,
m_pdcMem,0,0,m_sizeSource.cx,m_sizeSource.cy,mana);
}
else {
pDC->StretchBlt(0,0,m_sizeSource.cx,m_sizeSource.cy,
m_pdcMem,0,0,m_sizeSource.cx,m_sizeSource.cy,mana);
}}//在CzoomView 类中,用ClassWizard 响应WM_MOUSEMOVE消息
void CZoomPartView::OnMouseMove(UINT nFlags, CPoint point)
{
//计算要放大的局部矩形的源图像位置和目标位置
CString cord;
int dd;
CRect srect,drect,mrect;
srect.left = point.x - s;
srect.top = point.y - s;
srect.right = point.x + s;
srect.bottom = point.y + s;
drect.left = point.x - d;
drect.top = point.y - d;
drect.right = point.x + d;
drect.bottom = point.y + d;
mrect.left = oldx - d;
mrect.top = oldy - d;
mrect.right = oldx + d;
mrect.bottom = oldy + d;
dd = 2*d;
CDC * pDC = GetDC();
OnPrepareDC(pDC);
//放大图像
if (recover)
{
pDC->BitBlt(mrect.left,mrect.top,dd,dd,
m_pdcMem,mrect.left,mrect.top,mana);
}
pDC->StretchBlt(drect.left,drect.top,
drect.Width(),drect.Height(),m_pdcMem,srect.left,
srect.top,srect.Width(),srect.Height(),SRCCOPY);
oldx = point.x; oldy = point.y;
ReleaseDC(pDC);
recover = true; CView::OnMouseMove(nFlags, point);
}
//同样 响应鼠标按下的消息void CZoomPartView::OnLButtonDown(UINT nFlags, CPoint point)
{
//如果鼠标位置不在位图上,则还原位图大小显示
CRect rc(0,0,m_sizeSource.cx,m_sizeSource.cy);
if(!rc.PtInRect(point))
{
Invalidate();
}
else if (d > 5)//如果放大倍数大于5,就继续减小放大倍数,然后进行放大显示
{
CDC * pDC = GetDC();
pDC->StretchBlt(oldx - d,oldy - d,2*d,
2*d,m_pdcMem,oldx - d,oldy - d,2*d,2*d,mana);
d -= 10;
ReleaseDC(pDC);
CZoomPartView::OnMouseMove(nFlags, point);
}
CView::OnLButtonDown(nFlags, point);
}//编译运行
或者使用XFORM(查查MSDN就知道了)可作自有变化
或者自己写(使用反向变换,插值确定位图数据)