图片大小问题 在picBox上显示一张图片,怎末处理不会使图片比例失调,有没有相关的按比例变化的函数,控件大小已定的情况下? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 控制图片的大小不行吗?width and height JS代码(随便放哪里):<script language="JavaScript"> <!-- var flag=false; function DrawImage(ImgD){ var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ flag=true; if(image.width/image.height>= 180/110){ if(image.width>180){ImgD.width=180; ImgD.height=(image.height*110)/image.width; }else{ ImgD.width=image.width;ImgD.height=image.height; } /*ImgD.alt="bigpic" */} else{ if(image.height>110){ImgD.height=110; ImgD.width=(image.width*110)/image.height; }else{ ImgD.width=image.width;ImgD.height=image.height; } /*ImgD.alt="bigpic" */ } }}//--> </script>图片使用的地方:<img src="图片" border=0 width="180" height="110" onload="javascriptrawImage(this);">width="180" height="110" 注意这里最好限定,如果不限定加载图时会成原大,然后再缩小,这个过程如果图大了很难看的.这里是宽度和高度,在前面的JS里改,这里也作相应的改.图不会变形,只会按比列缩,放心 本篇文章来源于 《求学快递网》转载请以链接形式注明出处 网址:http://www.studyems.com/network/4483927586514383.html WPF 中listbox的用法疑问 多线程中使用webbrowser出现的报错 求助:关于Web引用 如何设计变更单? listbox实现拖拽后,click时间不起作用了怎么办 请教简单vs.net启动配置问题(web.config) 怎样判断BT文件已经下载完成? asp.net(c#)客户端访问水晶报表文件,弹出连接到服务器登录窗口,求解决办法 C#操作数据库的问题 如何判断一个窗体已经关闭?在线等待 谁有MCPD 题库啊? 软件打包
<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 180/110){
if(image.width>180){
ImgD.width=180;
ImgD.height=(image.height*110)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
/*ImgD.alt="bigpic" */
}
else{
if(image.height>110){
ImgD.height=110;
ImgD.width=(image.width*110)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
/*ImgD.alt="bigpic" */
}
}
}//-->
</script>
图片使用的地方:
<img src="图片" border=0 width="180" height="110" onload="javascriptrawImage(this);">
width="180" height="110" 注意这里最好限定,如果不限定加载图时会成原大,然后再缩小,这个过程如果图大了很难看的.这里是宽度和高度,在前面的JS里改,这里也作相应的改.图不会变形,只会按比列缩,放心 本篇文章来源于 《求学快递网》转载请以链接形式注明出处 网址:http://www.studyems.com/network/4483927586514383.html