zoukankan      html  css  js  c++  java
  • 显示Flash时控制其的宽度与高度

    Flash在网页显示时,如果不指定其正确的宽度或高度或是按其宽高一定的比例,会变形。

    你可以从下面地址参考到怎样取得Flash的宽度或是高度一些信息。http://www.codeproject.com/KB/graphics/ReaderSWFHeader.aspx

    为了更好了解,Insus.NET在下面写了一个swf类别(代码部分)

    View Code
     public Swf(int Width, int Height, int ThumbnailSize, string File)
            {

                
    this._Width = Width;
                
    this._Height = Height;
                
    this._ThumbnailSize = ThumbnailSize;
                
    this._File = File;
            }

            
    public string Player()
            {
                
    int f_Width;
                
    int f_Height;

                
    if (_ThumbnailSize > 0)  //如果指定Flash缩略显示
                {
                    
    //如果Flash的宽度与高度都小于指定缩略尺寸
                    if (_Width < _ThumbnailSize && _Height < _ThumbnailSize)
                    {
                        f_Width 
    = _Width; //等于原来的宽度
                        f_Height = _Height;//等于原来的高度
                    }
                    
    //如果宽度大于高度
                    else if (_Width > _Height)
                    {
                        f_Width 
    = _ThumbnailSize;
                        f_Height 
    = _Height * _ThumbnailSize / _Height;
                    }
                    
    //如果高度大于宽度
                    else
                    {
                        f_Width 
    = _Width * _ThumbnailSize / _Height;
                        f_Height 
    = _ThumbnailSize;
                    }
                }
                
    else
                {
                    f_Width 
    = _Width;
                    f_Height 
    = _Height;
                }

                
    return @"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'width=" + f_Width + " height=" + f_Height + ">"
                
    + @" <param name='movie' value=" + _File + ">"
                
    + @" <param name='quality' value='high'>"
                
    + @"<embed src=" + _File + " quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width=" + f_Width + " height=" + f_Height + "></embed>"
                
    + @" </object>";
            }

    xxx.aspx使用:

    <asp:Literal ID="Literal1" runat="server"></asp:Literal>

    xxx.aspx.cs:

    View Code
     //codeproject下载的Flash类别,Insus.NET曾经修改过,改为FlashInfo,基本是一样的,只不过添加一些自己的属性。
                    FlashInfo objFlashInfo = new FlashInfo(Server.MapPath(file));                
                    Swf objSwf 
    = new Swf(objFlashInfo.Width, objFlashInfo.Height,400, file);
                    
    this.Literal1.Text = objSwf.Player();
  • 相关阅读:
    db2 load命令装载数据时定位错误出现的位置
    DB2 SQL error: SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 3
    db2重组所有表和更新表统计信息
    DB2消息
    db2 SQL查询路径
    db2备份与恢复
    博弈-题表
    【POJ1082】Calendar Game (博弈)
    【POJ1067】取石子游戏 (威佐夫博弈)
    【POJ3710】Christmas Game (博弈-树上的删边问题)
  • 原文地址:https://www.cnblogs.com/insus/p/1994167.html
Copyright © 2011-2022 走看看