zoukankan      html  css  js  c++  java
  • 象yhoo相册那样在网页上操作图片(不完全)_2

    操作页面后面代码

    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)
            
    {
                
    亮度减少
            }



  • 相关阅读:
    HTML 列表中的dl,dt,dd,ul,li,ol区别及应用
    JS中关于clientWidth offsetWidth scrollWidth 等的含义
    关于javascript中dataset的问题小结
    AMD CMD ,requirejs seajs 区别
    [if IE ]>与<![endif]
    windows下实现wamp与tomcat环境整合
    webstorm 设置jsp支持
    js获取客户端IP及地理位置
    AngularJS所有版本下载地址
    jQuery插件开发全解析
  • 原文地址:https://www.cnblogs.com/cerxp/p/80870.html
Copyright © 2011-2022 走看看