读书人

简单的图形处理有关问题

发布时间: 2012-01-21 21:31:43 作者: rapoo

简单的图形处理问题
假设PictureBox1有图片,需要在PictureBox2显示PictureBox1中间的一部分图片。应该怎么处理?

[解决办法]
VB版本:
dim X,Y,Width,Height ,i ,j as integer
dim mybitmaptarget,mybitmapsource as bitmap
dim mycolor as color
x=你切图的左端点
y=你切图的上端点
width=你切图的宽度
height=你切图的高度
mybitmaptarget=new bitmap(width,height)
mybitmapsource=你要切得图

for i=x to i <x+width
for j=y to j <y + height
mycolor=mybitmapsource.getpixel(i,j)
mybitmaptarget.setpixel(i-x,j-y,mycolor)
next
next
够清楚了吧,记得给分!!!

读书人网 >VB Dotnet

热点推荐