c#如何去白边 c#去白边怎么弄用的是picturebox 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /// <summary> /// 截取图片区域,返回所截取的图片 /// </summary> /// <param name="SrcImage"></param> /// <param name="pos"></param> /// <param name="cutWidth"></param> /// <param name="cutHeight"></param> /// <returns></returns> private Image cutImage(Image SrcImage, Point pos, int cutWidth, int cutHeight) { Image cutedImage = null; //先初始化一个位图对象,来存储截取后的图像 Bitmap bmpDest = new Bitmap(cutWidth, cutHeight, PixelFormat.Format32bppRgb); Graphics g = Graphics.FromImage(bmpDest); //矩形定义,将要在被截取的图像上要截取的图像区域的左顶点位置和截取的大小 Rectangle rectSource = new Rectangle(pos.X, pos.Y, cutWidth, cutHeight); //矩形定义,将要把 截取的图像区域 绘制到初始化的位图的位置和大小 //rectDest说明,将把截取的区域,从位图左顶点开始绘制,绘制截取的区域原来大小 Rectangle rectDest = new Rectangle(0, 0, cutWidth, cutHeight); //第一个参数就是加载你要截取的图像对象,第二个和第三个参数及如上所说定义截取和绘制图像过程中的相关属性,第四个属性定义了属性值所使用的度量单位 g.DrawImage(SrcImage, rectDest, rectSource, GraphicsUnit.Pixel); //在GUI上显示被截取的图像 cutedImage = (Image)bmpDest; g.Dispose(); return cutedImage; } 再套一个picturebox在外面,里面的top left设置为负,把白边遮起来 属性里BorderStyle设置为None。 一道面试题 关于多线程的 请大家给个解决方案 求助,TreeView节点托拽时无法自定义光标 安装前卸载前面的旧版本 Access数据库并发访问的问题,在线等。 C#中怎么给结构体的嵌套结构体数组赋值 datagrid或datalist中获取checkbox的id。 求教:在不加入gac的情况下,如何将程序的搜索目录设置为指定的绝对路径? winform的属性设置 DateTimePicker控件的双击事件为何不起作用??? 代表到底是什么东西? substring截取的问题 devExpress button 控件修改text属性为中文,整个vs 软件就崩溃
/// 截取图片区域,返回所截取的图片
/// </summary>
/// <param name="SrcImage"></param>
/// <param name="pos"></param>
/// <param name="cutWidth"></param>
/// <param name="cutHeight"></param>
/// <returns></returns>
private Image cutImage(Image SrcImage, Point pos, int cutWidth, int cutHeight)
{
Image cutedImage = null; //先初始化一个位图对象,来存储截取后的图像
Bitmap bmpDest = new Bitmap(cutWidth, cutHeight, PixelFormat.Format32bppRgb);
Graphics g = Graphics.FromImage(bmpDest); //矩形定义,将要在被截取的图像上要截取的图像区域的左顶点位置和截取的大小
Rectangle rectSource = new Rectangle(pos.X, pos.Y, cutWidth, cutHeight);
//矩形定义,将要把 截取的图像区域 绘制到初始化的位图的位置和大小
//rectDest说明,将把截取的区域,从位图左顶点开始绘制,绘制截取的区域原来大小
Rectangle rectDest = new Rectangle(0, 0, cutWidth, cutHeight); //第一个参数就是加载你要截取的图像对象,第二个和第三个参数及如上所说定义截取和绘制图像过程中的相关属性,第四个属性定义了属性值所使用的度量单位
g.DrawImage(SrcImage, rectDest, rectSource, GraphicsUnit.Pixel); //在GUI上显示被截取的图像
cutedImage = (Image)bmpDest; g.Dispose(); return cutedImage; }