我菜固我在

博客园 首页 新随笔 联系 订阅 管理
操作页面后面代码

protected System.Web.UI.WebControls.Image MyImage;
        
//private System.Drawing.Image ResultImg = null;
        private void Page_Load(object sender, System.EventArgs e)
        
{
            
// 在此处放置用户代码以初始化页面
            if(!Page.IsPostBack)
            
{
                urlStr.Value
="fileName=3_21165.jpg";
                ChangImag();
            }

        }



        
        
private void Button1_Click(object sender, System.EventArgs e)
        
{
            
string strFilename=string.Empty;
            System.Drawing.Image  i;
            strFilename 
= Server.MapPath("img/3_21165.jpg");
 
            i 
= System.Drawing.Image.FromFile(strFilename);
 
            System.Drawing.Bitmap b 
=new System.Drawing.Bitmap(500,600); 
            Graphics g 
= System.Drawing.Graphics.FromImage(b); 
            
 
            
//'切割图片
 
            g.DrawImage(i,
new Rectangle(0,0,b.Width,b.Height),200,20,b.Width,b.Height,GraphicsUnit.Pixel);
            
 
            Response.ContentType
="image/jpeg";
 
            b.Save(Server.MapPath(
"img/1.jpg"),System.Drawing.Imaging.ImageFormat.Jpeg);
 
            b.Dispose();
            Response.Write(
"<script language='javascript'>alert('OK');</script>");

        }


        
private void TurnOne_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        
{
            
//翻转
            urlStr.Value
=goUrl;
            ChangImag();
        }

        
private void ChangImag()
        
{
            MyImage.ImageUrl
="MyImg.aspx?"+urlStr.Value;
        }


        
private void GoRr_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        
{
            
//顺时钟
            urlStr.Value
=goUrl;
            ChangImag();
            
        }


        
private void GoRl_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        
{
            
//逆时钟
            urlStr.Value
=goUrl;
            ChangImag();
        }


        
private void ContCut_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        
{
            
对比减小
        }


        
private void ContAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        
{
            
对比增加
        }


        
private void BrightAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        
{
            
亮度增加
        }


        
private void BrightCut_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        
{
            
亮度减少
        }



posted on 2004-12-23 10:10  大侠(cer)  阅读(684)  评论(0编辑  收藏  举报