C# 图片裁剪
/// <summary>
/// 缩小裁剪图片
/// </summary>
/// <param name="int_Width">要缩小裁剪图片宽度</param>
/// <param name="int_Height">要缩小裁剪图片长度</param>
/// <param name="input_ImgUrl">要处理图片路径</param>
/// <param name="out_ImgUrl">处理完毕图片路径</param>
public void ImgReduceCutOut(int int_Width, int int_Height, string input_ImgUrl, string out_ImgUrl)
{
// ===上传标准图大小===
int int_Standard_Width = 160;
int int_Standard_Height = 160;
int Reduce_Width = 0; // 缩小的宽度
int Reduce_Height = 0; // 缩小的高度
int CutOut_Width = 0; // 裁剪的宽度
int CutOut_Height = 0; // 裁剪的高度
int level = 100; //缩略图的质量 1-100的范围
// ===获得缩小,裁剪大小===
if (int_Standard_Height * int_Width / int_Standard_Width > int_Height)
{
Reduce_Width = int_Width;
Reduce_Height = int_Standard_Height * int_Width / int_Standard_Width;
CutOut_Width = int_Width;
CutOut_Height = int_Height;
}
else if (int_Standard_Height * int_Width / int_Standard_Width < int_Height)
{
Reduce_Width = int_Standard_Width * int_Height / int_Standard_Height;
Reduce_Height = int_Height;
CutOut_Width = int_Width;
CutOut_Height = int_Height;
}
else
{
Reduce_Width = int_Width;
Reduce_Height = int_Height;
CutOut_Width = int_Width;
CutOut_Height = int_Height;
}
// ===通过连接创建Image对象===
System.Drawing.Image oldimage = System.Drawing.Image.fromFile(Server.MapPath(input_ImgUrl));
相关文档:
号称xmlhelper的一个类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XML文档操作管理器
/// </summary>
public class XMLHelper
{
public X ......
一、认识Web.config文件
Web.config 文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的Web.config文件,包括默认 ......
创建一个Winform用户控件 UserControl1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace MyActiveT ......
public sealed class DbOper
{
///<summary>
/// DbOper类的构造函数
///</summary>
private DbOper()
{
}
......
OleDbConnection conn = null;
try
{
`string strConn;
&n ......