• 按比例缩小图片(高度按缩小按宽度的缩小比例缩小)


            /// <summary>
            /// 按比例缩小图片(高度按缩小按宽度的缩小比例缩小)
            /// </summary>
            /// <param name="ImageMap">界面显示的Image</param>
            /// <param name="ImagePath">图片虚拟路径</param>
            /// <param name="WidthSize">图片缩小后定下的宽度</param>
            /// <param name="Server">本页的Server</param>
            public void ImageSize(System.Web.UI.WebControls.Image ImageMap, string ImagePath, int WidthSize,System.Web.HttpServerUtility Server)
            {
                System.Drawing.Image Img = System.Drawing.Image.FromFile(Server.MapPath(ImagePath));
                int ImgWidth = Img.Width;
                int ImgHeight = Img.Height;
                ImageMap.ImageUrl = ImagePath;
                if (ImgWidth > WidthSize)
                {
                    ImageMap.Width = WidthSize;
                    ImageMap.Height = WidthSize * ImgHeight / ImgWidth;
                }
            }
  • 相关阅读:
    JavaSE-集合的遍历
    JavaSE-Collection常用方法
    JavaSE-异常
    JavaSE-匿名类_匿名内部类的使用
    JavaSE-内部类
    JavaSE-接口应用举例
    java线程的使用(Runnable)
    list根据所存对象属性排序
    Unable to locate appropriate constructor on class异常
    redis在java项目中的使用
  • 原文地址:https://www.cnblogs.com/cuihongyu3503319/p/605283.html
Copyright © 2020-2023  润新知