一个自动动态播放图片的类(downmoon)新增图片效果
第一步:创建一个类clsTurnPicture
增加方法如下 :
/// 播放图片类(downmoon)
/// </summary>
/// <param name="arrImgName">arrImgName</param>
/// <param name="arrDesc">arrDesc</param>
/// <param name="strShopName">strShopName</param>
/// <param name="strBrandName">strBrandName</param>
/// <param name="strResoourceCode">strResoourceCode</param>
/// <param name="ScrWidth">ScrWidth</param>
/// <param name="ScrHeight">ScrHeight</param>
/// <param name="PicWidth">PicWidth</param>
/// <param name="PicHeight">PicHeight</param>
/// <param name="TextHeight">TextHeight</param>
/// <param name="ToolBarHeight">ToolBarHeight</param>
/// <param name="FontSize">默认为16,px</param>
/// <returns></returns>
public string getPicsForHtml(ArrayList arrImgName,ArrayList arrDesc,string strShopName,string strBrandName,string strResoourceCode,int ScrWidth,int ScrHeight,int PicWidth,int PicHeight,int TextHeight,int ToolBarHeight,int FontSize)
...{
StringBuilder sb = new StringBuilder();
string strHtml="";
if(arrImgName==null) return "" ;
ArrayList ar1=new ArrayList(arrImgName);
ArrayList ar2=new ArrayList(arrDesc);
int len=ar1.Count;
int len2=ar1.Count-1;
int len3=ToolBarHeight-2;
string str1="";
string str2="";
//strHtm+=@" <html><head><title>Buynow{0}-{1}-{2}图片信息</title>
strHtml=@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"" ><HTML><HEAD><title>"+ strShopName+"-"+strBrandName+"-"+"席位:"+strResoourceCode+ "-外观展示图"+
@"</title>
<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"">
<meta name=""GENERATOR"" Content=""Microsoft Visual Studio .NET 7.1"">
<meta name=""CODE_LANGUAGE"" Content=""C#"">
<meta name=""vs_defaultClientScript"" content=""JavaScript"">
<meta name=""vs_targetSchema"" content=""http://schemas.microsoft.com/intellisense/ie5""> "+System.Environment.NewLine;
sb.Append(strHtml);
sb.Append("<script language=JavaScript>"+" ");
sb.Append("<!-- Begin"+System.Environment.NewLine);
sb.Append("var interval = 6; // delay between rotating images (in seconds)"+System.Environment.NewLine);
sb.Append("interval *= 1000;"+System.Environment.NewLine);
sb.Append("var flagtime=0;"+System.Environment.NewLine);
sb.Append("var image_index = -1;"+System.Environment.NewLine);
sb.Append("image_list = new Array();"+System.Environment.NewLine);
sb.Append("note_list = new noteArray("+len2.ToString()+")"+System.Environment.NewLine);
sb.Append("var number_of_image = image_list.length;"+System.Environment.NewLine);
sb.Append("var timesnum=0; "+System.Environment.NewLine);
//strHtml=string.Format(strHtml,len.ToString());
string strTemp="";
for(int k=0;k<ar1.Count;k++)
...{
strTemp=ar1[k].ToString();
//strHtm+=" image_list[k] = new imageItem("+strTemp+")";
str1+=" image_list["+k.ToString()+"] = new imageItem(""+strTemp+"")"+"; ";
}
sb.Append(""+System.Environment.NewLine);
for(int k=0;k<ar2.Count;k++)
...{
strTemp=strShopName+"-"+strBrandName+"-"+strResoourceCode+"-"+ar2[k].ToString();
str2+=" note_list["+k.ToString()+"] = ""+strTemp+"""+"; ";
}
sb.Append(str1);
sb.Append(str2);
sb.Append("function noteArray(size)"+System.Environment.NewLine);
sb.Append("{"+System.Environment.NewLine);
sb.Append("this.length=size;"+System.Environment.NewLine);
sb.Append("for(i=1;i<=size;i++)"+System.Environment.NewLine);
sb.Append("{"+System.Environment.NewLine);
sb.Append(@"this[i]="""""+System.Environment.NewLine);
sb.Append(" }"+System.Environment.NewLine);
sb.Append("return this;"+System.Environment.NewLine);
sb.Append("}"+System.Environment.NewLine);
sb.Append("function counternum()"+System.Environment.NewLine);
sb.Append("{"+System.Environment.NewLine);
sb.Append("if( timesnum < "+len2.ToString()+")"+System.Environment.NewLine);
sb.Append("{"+System.Environment.NewLine);
sb.Append(" timesnum++;"+System.Environment.NewLine);
sb.Append(@"//document.all.slide_ent.src=""about:blank"";");
sb.Append(System.Environment.NewLine);
sb.Append(@"//document.all.slide_ent.src=""about:blank"";");
sb.Append(System.Environment.NewLine);
sb.Append(" }"+System.Environment.NewLine);
sb.Append("}"+System.Environment.NewLine);
sb.Append(@"function run(obj)
{
interval=obj.options[obj.selectedIndex].value*1000;
rotateImage();
}");
sb.Append(@"function stop()
{
interval=0;
}
function previous()
{
var new_image = getPreviousImage();
document[""rImage""].src = new_image;
}
function next()
{
var new_image = getNextImage();
document[""rImage""].src = new_image;
}
function imageItem(image_location)
{
this.image_item = new Image();
this.image_item.src = image_location;
}
function noteItem(note)
{
this.note_item = new Image();
this.note_item.src = note;
}
function get_ImageItemLocation(imageObj)
{
return(imageObj.image_item.src)
}
function get_NoteItemLocation(noteObj)
{
return(noteObj.note_item.src)
}
function generate(x, y)
{
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}");
sb.Append(@"function getPreviousImage()
{
image_index = image_index-1;
if (image_index < 0)
{");
sb.Append("image_index=image_index+"+len.ToString()+";");
sb.Append(@"}
var new_image = get_ImageItemLocation(image_list[image_index]);
document.all.span_1.innerText=image_index+1;
document.all.summary.innerText=note_list[image_index];
return(new_image);");
sb.Append(System.Environment.NewLine+"}");
sb.Append(@"function getNextImage()
{
image_index = image_index+1;
");
sb.Append("if (image_index >= "+len.ToString()+")");
sb.Append(System.Environment.NewLine);
sb.Append(@"{");
sb.Append(System.Environment.NewLine);
sb.Append("image_index=image_index-"+len.ToString()+";");
sb.Append(System.Environment.NewLine);
sb.Append("}");
sb.Append(System.Environment.NewLine);
//sb.Append(@"");
sb.Append(@"var new_image = get_ImageItemLocation(image_list[image_index]);
document.all.span_1.innerText=image_index+1;
document.all.summary.innerText=note_list[image_index];
return(new_image);");
sb.Append(System.Environment.NewLine+"}");
sb.Append(@"
//新增图片效果
function setTransition()
{
if (document.all)
{
document.all('rImage').filters.revealTrans.Transition=Math.floor(Math.random()*23);
document.all('rImage').filters.revealTrans.apply();
}
}
function playTransition()
{
if (document.all)
document.all('rImage').filters.revealTrans.play();
}");
strHtml=@"
function rotateImage()
{
if (interval == 0)
{
return 1;
}
if (flagtime == 1)
{
var now = new Date();
var time1 = now.getTime();
var time2;
time1=time1+3000;
time2=now.getTime();
while(time2 < time1)
{
now = new Date();
time2=now.getTime();
}
flagtime=0;
}
var new_image = getNextImage();
setTransition();//新增图片效果
document['rImage'].src = new_image;
var recur_call = ""rotateImage('""+'rImage'+""')"";
playTransition();//新增图片效果
setTimeout(recur_call,interval);
}
// End -->
</script>
<script type=""text/javascript"" src=""Resource/Script/ygcss.js""></script>
";
sb.Append(strHtml);
strHtml=@"</HEAD><body topmargin=""0"" leftmargin=""0""><form name=""frmDispImage"">";
sb.Append(strHtml);
strHtml=@"
<center>
<center>
<table bgcolor='#fff2df' border='0' cellpadding='0' cellspacing='0' width='"
+ScrWidth.ToString()+@"'>
<tbody><tr>
<td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody><tr>
<td height='1'></td>
</tr>
</tbody></table>
<table border='0' cellpadding='0' cellspacing='0' height='"+
PicHeight.ToString()+"' width='"+PicWidth.ToString()+@"' align='center'>
<tbody><tr>
<td align='center'><img name=""rImage"" src='"+
ar1[0].ToString()+"' width='"+PicWidth+"' height='"+PicHeight+@"' οnlοad=""counternum();"" border='0' style='FILTER: revealTrans(duration=3,transition=20)'></td>
</tr>
</tbody></table>
<!--text-->
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody><tr>
<td id=""summary"" align='center' height='"+
TextHeight.ToString()+"' style='font-size:"+FontSize.ToString()+"pt;'>"
+strShopName+"-"+strBrandName+"-"+strResoourceCode+"-"+ar2[0].ToString()+@"</td>
</tr>
</tbody></table>
<!--/text-->
<!--bottom-->
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody><tr>
<td><img src='Resource/Image/TurnImage/slideshow_bg_3.gif' border='0' height='4' width='"+ScrWidth.ToString()+@"'></td>
</tr>
<tr>
<td bgcolor='#c9beeb' height='"+ToolBarHeight.ToString()+@"'>
<table border='0' cellpadding='1' cellspacing='0' width='100%'>
<tbody><tr>
<td class='sbody' align='center' height='"+len3.ToString()+"'><font style='font-size:"+FontSize+"pt;'><span id='span_1'>1</span>/"+len.ToString()+
@"
< img src='Resource/Image/TurnImage/slideshows_bottom_1.gif' alt='开始 ' οnclick=""run(document.frmDispImage.select1)"" align='absmiddle' border ='0' height='21' width='35'> <img src='Resource/Image/TurnImage/slideshows_bottom_2.gif' alt ='停止' οnclick=""stop();"" align='absmiddle' border='0' height='21' width ='35'>
& nbsp; <img src='Resource/Image/TurnImage/slideshows_bottom_3.gif' alt ='前一张' οnclick=""previous();"" align='absmiddle' border='0' height= '21' width='35'> <img src='Resource/Image/TurnImage/slideshows_bottom_4.gif' alt ='后一张' οnclick=""next();"" align='absmiddle' border='0' height= '21' width='35'> 速度:
<select name=""select1"" οnchange=""run(this)"">
<option value=""12"">12 sec.</option>
<option selected=""selected"" value=""6"">6 sec.</option>
<option value=""3"">3 sec.</option>
<option value=""9"">9 sec.</option>
</select></font></td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td bgcolor='#625a68' height='1'></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<!--/--></center>
<script language=""javascript"">
flagtime=1;
rotateImage();//修改为图片自动播放
<!--slideit()-->
</script>
</center>";
sb.Append(strHtml);
sb.Append("</form></body></HTML>");
return sb.ToString();
}
调用格式:
/**///// ArrayList ar1=new ArrayList();
//// ar1.Clear();
//// ar1.Add("http://downmoon-hgh/RichChartServer/Top30/frmForumDisplayImage.aspx?id=160720060328095407");
//// ar1.Add("http://downmoon-hgh/RichChartServer/Top30/frmForumDisplayImage.aspx?id=160420060327085709");
//// ar1.Add("http://downmoon-hgh/RichChartServer/Top30/frmForumDisplayImage.aspx?id=160420060327091030");
//// ar1.Add("http://downmoon-hgh/RichChartServer/Top30/frmForumDisplayImage.aspx?id=160420060327092445");
////
//// drawPic(ar1);
if(this.ar1==null || ar1.Count==0 )
...{
// this.MsgBox("该席位/资源无外观图!");
// this.CloseWebForm();
return ;
}
else
...{
drawPic(ar1);
}
private void drawPic(ArrayList arrImages)
...{
if(pic==null)
...{
pic=new clsTurnPicture();
}
int i;
ArrayList ar2=new ArrayList();
ar2.Clear();
for(int k=0;k<arrImages.Count;k++)
...{ i=k+1;
ar2.Add("展示图"+i.ToString());
}
Response.Write(pic.getPicsForHtml(arrImages,ar2,CurrShopName,CurBrandName,strResourceCode,1024,768,1022,640,36,34,16));
}
一个自动动态播放图片的类(downmoon)新增图片效果相关推荐
- 图片渲染 类得修改 图片版本得适配
child.tabBarItem.image = [UIImage imageWithName:imageName]; UIImage *selectedImage = [UIImage imageW ...
- php 保留2位整数 补白,php图片处理类 缩放有补白效果
/** * Author : smallchicken * Time : 2009年6月8日16:46:05 * Last Time: 2010年5月5日 10:24:30 * mode 1 : 强制 ...
- 动态播放幻灯片 计算机教案,小学信息技术《动态播放幻灯片-设置幻灯片文字的动画效果》教案...
一.教学目标 1.能独立设置幻灯片文字的动画效果,合理选择动画效果. 2.通过小组合作设置有个性的动画效果,锻炼学生的合作探究能力以及创新精神. 3.通过本节课的学习,体会成功的喜悦,增强自信心,激发 ...
- 动态播放幻灯片 计算机教案,2021河北特岗教师面试:小学信息技术《动态播放幻灯片-设置幻灯片文字的动画效果》教案...
在 一.教学目标 1.能独立设置幻灯片文字的动画效果,合理选择动画效果. 2.通过小组合作设置有个性的动画效果,锻炼学生的合作探究能力以及创新精神. 3.通过本节课的学习,体会成功的喜悦,增强自信心, ...
- 自己动手之使用反射和泛型,动态读取XML创建类实例并赋值
前言: 最近小匹夫参与的游戏项目到了需要读取数据的阶段了,那么觉得自己业余时间也该实践下数据相关的内容.那么从哪入手呢?因为用的是Unity3d的游戏引擎,思来想去就选择了C#读取XML文件这个小功能 ...
- java 给图片加马赛克_java处理图片--图片的缩放,旋转和马赛克化
下面是编程之家 jb51.cc 通过网络收集整理的代码片段. 编程之家小编现在分享给大家,也给大家做个参考. 这是我自己结合网上的一些资料封装的java图片处理类,支持图片的缩放,旋转,马赛克化.(转 ...
- 图片自动切换播放的一个效果(类似幻灯片播放)
首先,我们先来设置一个装自动切换播放图片的容器,给这个容器宽设为640px,高640px,并且让它上边距为100px,左右居中,再放入一张图片,设置图片不能重复,如果你还想让它美观点,也可以把图片设为 ...
- 封装一个类,下载图片、【复制文本和复制图片到粘贴板上,分享到微信、QQ好友】等多功能
原理:利用canvas处理生成一个新的图片url地址,然后在进行其他操作. 1.html代码 <div class="codeImage-box"><span c ...
- php的图像处理有哪些实际作用,PHP_一个经典实用的PHP图像处理类分享,本图像处理类可以完成对图片 - phpStudy...
一个经典实用的PHP图像处理类分享 本图像处理类可以完成对图片的缩放.加水印和裁剪的功能,支持多种图片类型的处理,缩放时进行优化等. /** file: image.class.php 类名为Imag ...
- 用python实现一个自动保存复制图片的功能
由于经常写作,需要为文章准备一些配图,通常这些配图是从百度图片搜索里准备的.在准备图片时,我遇到了两个小麻烦: 有些图片的格式是webp,需要在另存为时指定格式 有些图片需要剪切,剪切后不能直接复制到 ...
最新文章
- SAP LSMW 因物料描述里有换行符或者引号导致数据导入失败
- awk打印第一个字母
- Cubieboard2裸机开发之(四)定时器操作
- rola物联网框架_如何搭建一个物联网系统框架?
- NSMutableArray利用for循环时要注意的问题
- php自动计数,PHP 实现精确统计在线人数功能
- 一道丧心病狂的java面试题
- Beaglebone Back学习五(PWM测试)
- 512抗击震灾捐款背后的思考
- Linux命令总结(之二)Find
- [转载] 机器学习 scikit-learn1 预测贷款用户是否会逾期
- 语句 if else
- 魔兽世界单机版(模拟器)入门介绍--Starting off with WoW Emulation. 翻译
- t480 拆触摸板_用料不错 ThinkPad翼480笔记本拆机解析
- SiTime硅晶振温度传感技术
- cdr多页面排版_cdr排版实例图文教程,教你CorelDRAW杂志内页排版方法
- 计算机桌面变蓝屏,电脑进入桌面蓝屏解决方法
- 【Codeforces】 B. Make it Divisible by 25
- 快圣诞节了,用Python 送你一棵圣诞树
- 【接口技术】实验二:基本I/O实验
热门文章
- 16 数值的整数次方 (第3章 高质量的代码-代码的完整性)
- Android 测试 之MonkeyRunner
- FZU 2020 组合
- 服务器上装的hadoop系统,在Ubuntu Server 18.04.1中安装Hadoop系统环境
- stm32驱动ssd1306配置_自制FOC控制驱动器
- win10连接共享打印机_win7共享出来的打印机部分电脑无法连接的问题
- adb.exe可能被其他程序关闭_苹果说关闭后台 反而会缩短电池寿命?!
- ArcGIS案例学习笔记4_2_水文分析批处理地理建模
- linux系统--C语言程序开发的基本步骤(包含gcc的基本步骤)
- Elasticsearch5.X Centos7安装过程