您的位置:程序门 -> .net技术 -> c#



c# 获取图片中指定区域


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


c# 获取图片中指定区域
发表于:2007-09-26 22:21:04 楼主
我要用一张图片作为窗体背景图,我不需要整张图片,我只要图片中某个区域,比如从这张图片内的位置点(50,50)开始,宽100,长100的矩形区域图象.如何获得?
bitmap   pic   =   new   bitmap(@ "c:\bmp.bmp ");
......
发表于:2007-09-26 22:41:451楼 得分:0
up
发表于:2007-09-27 01:48:282楼 得分:0
photoshop,或者调出这张图,将其读成3d数组a(宽*高*rgb),新生成一个数组b,将a中的指定区域放到b中,然后将b生成为一个bitmap即可。如果要速度优先,可通过指针操作来实现图和数组的转换工作
发表于:2007-10-06 01:26:383楼 得分:0
没有其他方法了么....
发表于:2007-10-06 15:05:484楼 得分:0
使用graphics的drawimage
void   drawimage(image   image,rectangle   rectdst,float   x,float   y,float   cx,float   cy,graphicsunit.pixel);


image   =   image.fromfile(@"c:\bmp.bmp");  
rectangle   rectsrc   =   new   rectangle(50,50,100,100);
rectangle   rectdst   =   new   rectangle(0,0,clientrectangle.width,clientrectangle.height);

grfx.drawimage(image,rectdst,rectsrc,graphicsunit.pixel);
发表于:2007-10-12 23:26:045楼 得分:0
thx   u,u   r   gosu~


快速检索

最新资讯
热门点击