OpenFileDialog openfile = new OpenFileDialog();
openfile.Filter = "Bmp Picture(*.*)|*.bmp";
if (openfile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
IsPictureImported = true; Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
Image img = new Bitmap(openfile.FileName);
img = DeleteBlankArea(img);
}
从文件读取了一张图片,请问DeleteBlankArea()怎么写呢,要去掉图片四周的空白部分。初步想法是四个双重循环,用像素检测出上下左右最初有图像的未知a,b,c,d.可是不知道怎么把这一部分另存为图片。或者有更好的处理办法?
解决方案 »
- C# 编的Winform启动好慢
- AspNetPager1.RecordCount
- C# 将dataset更改保存到数据源
- 谁有protype 框架开发的日历控件?
- C#中如何创建链表?
- 我只想通过WORD打开指定目录(如:d:\myfile\aa\xxx.doc)的文件,代码怎么写啊???
- 如何在用户控件中直接使用在主页面中已经打开的数据库连接?
- 请问高人,在.NET下如何将外部的*.C的代码编译成Dll,然后在C#下调用
- 新手 请各位帮忙!先谢了!!
- 求推荐 wpf C/S架构访问Access数据库的框架
- 关于一个string计算的问题
- c#点击一个按钮 从数据库一个表中获取其中两个字段的值???
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
//openFileDialog1.Filter = "*.bmp|*.gif|*.jpg|*.*";
string filename = openFileDialog1.FileName;
Image img = Image.FromFile(filename);
pictureBox1.Image = img;
}
这样就行了,调整picturebox的缩放模式属性为stretchimage啊