C#画图问题 最近遇到一个需要Asp.net画图的问题,实现的效果是: 黑色框框是固定的,红色的是通过计算得来的,求各位大侠帮帮忙啊。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考Bitmap类,创建一个Bitmap位图对象,然后取得Bitmap的Graphics对象,然后就可以画图了,然后再用Bitmap的方法保存成为jpg文件, 大约就是这样, //新建一个bmp图片 System.Drawing.Image bitmap = new System.Drawing.Bitmap(towidth, toheight); //新建一个画板 System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap); //设置高质量插值法 g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量,低速度呈现平滑程度 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //清空画布并以透明背景色填充 g.Clear(System.Drawing.Color.Transparent); //在指定位置并且按指定大小绘制原图片的指定部分 g.DrawImage(originalImage, new System.Drawing.Rectangle(0, 0, towidth, toheight), new System.Drawing.Rectangle(x, y, ow, oh), System.Drawing.GraphicsUnit.Pixel); try { //以jpg格式保存缩略图 bitmap.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg); } catch (System.Exception e) { throw e; } finally { originalImage.Dispose(); bitmap.Dispose(); g.Dispose(); } 频繁交互服务端会产生大量的数据流量,还得启用AJAX如果是 进度条,只需要改变边框的红色的宽度即可 可以试着用多个Div代替嘛。 关于控件的数据绑定。 关于C#中类的可访问范围问题 txt文件是动态更新的,如何读取更新部分 问一个IntPrt使用的问题 水晶报表10与vs2003是否匹配 [ADO.NET问题]请教C#windows窗体程序LOGIN的代码怎么去写? DLl存在,却无法加载,怪哉。。。Why??? 关于字符串操作问题? 高手请问:C#写的应用程序 是否可以在win98,win me 运行? 谁有两表格对比数据合成一个表格的软件啊 CurrencyManager.Current问题 Devexpress SchedulerControl控件中自定义事件问题
System.Drawing.Image bitmap = new System.Drawing.Bitmap(towidth, toheight); //新建一个画板
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap); //设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //清空画布并以透明背景色填充
g.Clear(System.Drawing.Color.Transparent); //在指定位置并且按指定大小绘制原图片的指定部分
g.DrawImage(originalImage, new System.Drawing.Rectangle(0, 0, towidth, toheight),
new System.Drawing.Rectangle(x, y, ow, oh),
System.Drawing.GraphicsUnit.Pixel); try
{
//以jpg格式保存缩略图
bitmap.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch (System.Exception e)
{
throw e;
}
finally
{
originalImage.Dispose();
bitmap.Dispose();
g.Dispose();
}
频繁交互服务端会产生大量的数据流量,还得启用AJAX如果是 进度条,只需要改变边框的红色的宽度即可