zoukankan      html  css  js  c++  java
  • resize

    void resize()
    {
        ;
        if (toWidth > toHeight)
        {
            if(orgHeight > orgWidth)
            {
                retHeight = toHeight;
                retWidth = orgWidth / orgHeight * toHeight;

            }
            if (orgHeight < orgWidth)
            {

                if (orgHeight / orgWidth * toWidth > toHeight)
                {
                    retHeight = toHeight;
                    retWidth = orgWidth / orgHeight * toHeight;

                }
                else
                {
                    retWidth = toWidth;
                    retHeight = orgHeight /orgWidth * toWidth;
                }

            }
            if (orgHeight == orgWidth)
            {
                retHeight = toHeight;
                retWidth = orgWidth / orgHeight * toHeight;
            }
        }

        if (toWidth < toHeight)
        {
            if(orgHeight > orgWidth)
            {
                if (orgWidth / orgHeight * toHeight > toWidth)
                {
                    retWidth = toWidth;
                    retHeight = orgHeight / orgWidth * toWidth;
                }
                else
                {
                    retHeight = toHeight;
                    retWidth = orgWidth / orgHeight * toHeight;
                }
            }
            if (orgHeight < orgWidth)
            {
                retWidth = toWidth;
                retHeight = orgHeight / orgWidth * toWidth;
            }
            if (orgHeight == orgWidth)
            {
                retWidth = toWidth;
                retHeight = orgHeight / orgWidth * toWidth;
            }
        }

        if (toWidth == toHeight)
        {
            if(orgHeight > orgWidth)
            {
                retHeight = toHeight;
                retWidth = orgWidth / orgHeight * toHeight;
            }
            if (orgHeight < orgWidth)
            {
                retWidth = toWidth;
                retHeight = orgHeight / orgWidth * toWidth;
            }
            if (orgHeight == orgWidth)
            {
                retHeight = toHeight;
                retWidth  = toWidth;

            }
        }

    }

  • 相关阅读:
    WPF开发经验
    权限管理系统项目心得
    《鸟哥的Linux私房菜》笔记——02. 关于Linux
    《鸟哥的Linux私房菜》笔记——01. 计算机概论
    「JavaSE 重新出发」02.02 引用数据类型
    「JavaSE 重新出发」02.01 基本数据类型
    「JavaSE 重新出发」02. 数据类型与运算符
    「JavaSE 重新出发」01. Java介绍
    cmd 与 网卡(netsh 命令)
    Python 基础总结
  • 原文地址:https://www.cnblogs.com/perock/p/2555878.html
Copyright © 2011-2022 走看看