+ -
当前位置:首页 → 问答吧 → vml中显示文字,定位??

vml中显示文字,定位??

时间:2004-06-15

来源:互联网

<v:group ID='group1' style='WIDTH:500pt;HEIGHT:300pt;color:red;' coordsize='5000,3000' >
   </v:group>
中显示文字,如何定位呢?我想的是相对<v:group ID定位。

下面的代码是绝对位置定位,如果 “<v:group ID” 的大小改变后,其位置不会跟着改变
<P class="Chart" style="LEFT:505px;POSITION:absolute;TOP:380px;HEIGHT:5.6pt;TEXT-ALIGN:center">hello</P>

作者: luoxuanhua   发布时间: 2004-06-15


<html xmlns:v="urn:schemas-microsoft-com:vml"> <STYLE> v\:* { Behavior: url(#default#VML) } </STYLE> <style> .drag{cursor:move} </style> <SCRIPT> var dragapproved=false var z,x,y // 移动 function move(){ if (event.button==1&&dragapproved){ if( (temp1+event.clientX-x)<0 || (temp2+event.clientY-y)<0 ) { return false } z.style.pixelLeft=temp1+event.clientX-x z.style.pixelTop=temp2+event.clientY-y return false}} //判断 function drags(){ if (!document.all) return if (event.srcElement.className=="drag"){ dragapproved=true z=event.srcElement temp1=z.style.pixelLeft temp2=z.style.pixelTop x=event.clientX y=event.clientY document.onmousemove=move}} document.onmousedown=drags document.onmouseup=new Function("event.srcElement.StrokeColor='';dragapproved=false") </SCRIPT> <body> My DIV<br/> <DIV style="width:400px;height:400px; color:white; position:absolute;"> <v:group ID='group1' style='WIDTH:300pt;HEIGHT:300pt;color:red;' coordsize='300,300' > <v:oval style="position:absolute;left:45%;top:10;width:50;height:50" class="drag" /> <v:element o:button="expression"> <P class="Chart" style="LEFT:10px;POSITION:absolute;TOP:10px;HEIGHT:5.6pt;TEXT-ALIGN:center">hello</P> </v:group> </DIV> </body>
   提示:您可以先修改部分代码再运行

作者: 车仔   发布时间: 2004-06-16

你的做得很生动,但是文字的位置和大小并没有随着圆的大小和位置变化?

作者: luoxuanhua   发布时间: 2004-06-16

那就不懂你的需求了

作者: 车仔   发布时间: 2004-06-17

我的想法是让显示在vml图上的文字,其在vm图上l的坐标能够随着该图的变化大小自动调整啊,目的是当我们设置vml图缩小时,文字还是能够显示在vml相应的位置上,不使其错位啊。

作者: luoxuanhua   发布时间: 2004-06-18