当前位置:编程学习 > VB >>

[求助]怎么把一张图片分成几块小区域??

RT,这个该怎么做啊???有没有具体的例子什么的??求各位大神前辈指导指导!!! vb --------------------编程问答-------------------- 你想怎么分就怎么分啊, 这难道还有限制么? --------------------编程问答-------------------- 最简单的是用PictureClip控件。当然也可以用paintpicture方法,自己计算图片截取的尺寸。 --------------------编程问答-------------------- 用PictureBOX的PaintPicture
PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode
'x1, y1目标坐标(x-轴和y-轴)
'Width1、Height1 目标宽度、高度如果目标宽度、高度比源宽度、高度大或小,将适当地拉伸或压缩
'x2, y2在源图上截取图片坐标(x-轴和y-轴)
'Width2、Height2,在原图上截取图片的高度、宽度
例:
新建工程 加入四个pictureBOX 高3000,宽4000 
Picture1.PaintPicture LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"), 0, 0, 4000, 3000, 0, 0, 4000, 3000 '左上角左0,0,4000,3000大小,以下类推
Picture2.PaintPicture LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"), 0, 0, 4000, 3000, 4000, 0, 4000, 3000
Picture3.PaintPicture LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"), 0, 0, 4000, 3000, 0, 4000, 4000, 3000
Picture4.PaintPicture LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"), 0, 0, 4000, 3000, 4000, 3000, 4000, 3000
--------------------编程问答-------------------- 一年前我弄了一个,不在身边,晚上传上来。 --------------------编程问答-------------------- 可以考虑使用GDI+来划分,很容易。 --------------------编程问答--------------------
引用 2 楼 VBToy 的回复:
最简单的是用PictureClip控件。当然也可以用paintpicture方法,自己计算图片截取的尺寸。


后面的 参数都是什么意思啊 ?? --------------------编程问答-------------------- 看看WIN API函数大全中关于GDI部分的语法说明就行了。需要多个函数分步配合使用。
--------------------编程问答-------------------- 建议使用GDI+,个人认为是最简单可行的方法。

装载图像:
GdipLoadImageFromFile StrPtr("c:\1.jpg"), Img

裁剪图像(dx,dy,dw,dh 要裁剪的位置及大小) (sx,xy,xw,xh 源图像):
GdipDrawImageRectRectI Graphics, Img, dx, dy, dw, dh, sx, sy, sw, sh, UnitPixel
重复上面的语句,实现多次裁剪
补充:VB ,  多媒体
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,