Office中国论坛/Access中国论坛

标题: [分享][推荐]我也说说窗体上移动控件(代码少少) [打印本页]

作者: fannky    时间: 2006-5-22 19:31
标题: [分享][推荐]我也说说窗体上移动控件(代码少少)
刚刚看到有发表再创提上移动控件的贴子,看了看,就是觉得代码长。不过功能到挺全面,支持键盘移动!

本人收藏了一个范例,虽然只支持鼠标拖动,但是代码少少,有兴趣不妨看看


作者: 一点通    时间: 2006-5-23 06:14
确实很精练,本来想加你为精华贴的,但你已经在精华贴中发表了
作者: gordan    时间: 2006-5-23 08:20
不会做啊,教教我吧.
作者: shenlan    时间: 2006-5-23 09:55
管理员已经说好了,那一定要顶上
作者: LucasLynn    时间: 2006-5-23 15:40
以下是引用fannky在2006-5-22 11:31:00的发言:


刚刚看到有发表再创提上移动控件的贴子,看了看,就是觉得代码长。不过功能到挺全面,支持键盘移动!

本人收藏了一个范例,虽然只支持鼠标拖动,但是代码少少,有兴趣不妨看看



那个控件移动的程序只是EDF的使用范例而已,其目的在于介绍EDF的功能及使用方法。

你提供的代码很不错,同时也更加证明了EDF的作用,这段代码采用传统的事件编程方式,因此你现在为一个图形控件提供了移动功能,如果窗体上有十几个甚至几十个控件都要能够移动,恐怕就不是代码少少了,但是采用EDF后,依旧是那几行代码。













[此贴子已经被作者于2006-5-23 8:14:34编辑过]


作者: 王维a780    时间: 2006-5-23 17:41
dgbdchng
作者: fannky    时间: 2006-5-23 18:32
感谢两位管理员的支持与提点。

我只算是一个菜鸟,很多高深得东东还不懂,比如说EDF,还要继续学习啊!
作者: westwind01    时间: 2006-5-24 22:22
好东西呀
作者: zjgage    时间: 2006-5-25 04:58
好!支持!
作者: xljem    时间: 2006-5-25 05:56
kankan
作者: 5988143    时间: 2006-5-25 15:44
謝謝分享!
作者: wang1950317    时间: 2006-5-25 16:40
谢谢啦!
作者: duanpeng@    时间: 2006-5-25 18:57
学习一下
作者: williamlxc    时间: 2006-5-26 05:14
我想参考一下~ 谢谢
作者: xjliyuehua    时间: 2006-5-26 17:56
[em02][em02]
作者: XWQ2000    时间: 2006-5-27 18:51
fwewf
作者: xlonger    时间: 2006-5-27 20:02
DDDDDDDDDDDDDDD
作者: 阿智    时间: 2006-5-28 06:07
T
作者: tsilon    时间: 2006-5-28 16:11
thanks
作者: cte458    时间: 2006-5-29 17:08
支持!
作者: kinglou    时间: 2006-5-31 03:31
现在正需要正网页上移动用户控件呢,具体有例子吗
作者: t360103    时间: 2006-5-31 07:31
标题: hao
以下是引用fannky在2006-5-22 11:31:00的发言:
刚刚看到有发表再创提上移动控件的贴子,看了看,就是觉得代码长。不过功能到挺全面,支持键盘移动!本人收藏了一个范例,虽然只支持鼠标拖动,但是代码少少,有兴趣不妨看看

作者: 08a91lk    时间: 2006-6-1 05:00
提示: 作者被禁止或删除 内容自动屏蔽
作者: fannky    时间: 2006-6-5 19:47
标题: 回复:(kinglou)现在正需要正网页上移动用户控件呢,...
以下是引用kinglou在2006-5-30 19:31:00的发言:
现在正需要正网页上移动用户控件呢,具体有例子吗



这是JSP涉及的东东

<html>
<body>
<script language="javascript">
var IE5=(document.getElementById && document.all)? true : false;
var W3C=(document.getElementById)? true: false;
var currIDb=null, currIDs=null, xoff=0, yoff=0; zctr=0; totz=0;
function trackmouse(evt){
if((currIDb!=null) && (currIDs!=null)){
var x=(IE5)? event.clientX+document.body.scrollLeft : evt.pageX;
var y=(IE5)? event.clientY+document.body.scrollTop : evt.pageY;
currIDb.style.left=x+xoff+'px';
currIDs.style.left=x+xoff+10+'px';
currIDb.style.top=y+yoff+'px';
currIDs.style.top=y+yoff+10+'px';
return false;
}}

function stopdrag(){
currIDb=null;
currIDs=null;
NS6bugfix();
}

function grab_id(evt){
xoff=parseInt(this.IDb.style.left)-((IE5)? event.clientX+document.body.scrollLeft : evt.pageX);
yoff=parseInt(this.IDb.style.top)-((IE5)? event.clientY+document.body.scrollTop : evt.pageY);
currIDb=this.IDb;
currIDs=this.IDs;
}

function NS6bugfix(){
if(!IE5){
self.resizeBy(0,1);
self.resizeBy(0,-1);
}}

function incrzindex(){
zctr=zctr+2;
this.subb.style.zIndex=zctr;
this.subs.style.zIndex=zctr-1;
}

function createPopup(id, title, width, height, x , y , isdraggable, boxcolor, barcolor, shadowcolor, text, textcolor, textptsize, textfamily ){
if(W3C){
zctr+=2;
totz=zctr;
var txt='';
txt+='<div id="'+id+'_s" style="position:absolute; left:'+(x+10)+'px; top:'+(y+10)+'px; width:'+width+'px; height:'+height+'px; background-color:'+shadowcolor+'; filter:alpha(opacity=50); visibility:visible">&nbsp;</div>';
txt+='<div id="'+id+'_b" style="borderutset '+barcolor+' 2px; position:absolute; left:'+x+'px; top:'+y+'px; width:'+width+'px; overflow:hidden; height:'+height+'px; background-color:'+boxcolor+'; visibility:visible">';
txt+='<div style="width:'+width+'px; height:16px; background-color:'+barcolor+'; padding:0px; border:1px"><table cellpadding="0" cellspacing="0" border="0" width="'+(IE5? width-4 : width)+'"><tr><td width="'+(width-20)+'"><div id="'+id+'_h" style="width:'+(width-20)+'px; height:14px; font: bold 12px sans-serif; color:'+textcolor+'">&nbsp;'+title+'</div></td><td align="right"><a ><img src="close.gif" border="0" height="15" width="15"></a></td></tr></table></div>';
txt+='<div id="'+id+'_ov" width:'+width+'px; style="margin:2px; color:'+textcolor+'; font:'+textptsize+'pt '+textfamily+';">'+text+'</div></div>';
document.write(txt);
this.IDh=document.getElementById(id+'_h');
this.IDh.IDb=document.getElementById(id+'_b');
this.IDh.IDs=document.getElementById(id+'_s');
this.IDh.IDb.subs=this.IDh.IDs;
this.IDh.IDb.subb=this.IDh.IDb;
this.IDh.IDb.IDov=document.getElementById(id+'_ov');
if(IE5){
this.IDh.IDb.IDov.style.width=width-6;
this.IDh.IDb.IDov.style.height=height-22;
this.IDh.IDb.IDov.style.scrollbarBaseColor=boxcolor;
this.IDh.IDb.IDov.style.overflow="auto";
}else{
this.IDh.IDs.style.MozOpacity=.5;
}
this.IDh.IDb.onmousedown=incrzindex;
if(isdraggable){
this.IDh.onmousedown=grab_id;
this.IDh.onmouseup=stopdrag;
}}}

if(W3C)document.onmousemove=trackmouse;
if(!IE5 && W3C)window.onload=NS6bugfix;
createPopup( 'box3', '用鼠标可以移动此窗口!' ,  288, 90, 28, 200, true, 'FF9D6F' , '723838' , '800000' , '你需要什么效果?' , 'FFFFFF' , 9 , '宋体');
</script>
</body>
</html>

作者: tonywong    时间: 2006-6-6 00:28

作者: 66666qqq    时间: 2006-6-7 00:38
look
作者: ab00ab    时间: 2006-6-7 01:35
[em02][em02][em02]
作者: 红过刘德华    时间: 2006-6-13 16:46
标题: 支持!
支持
作者: 叶伟健    时间: 2006-7-6 23:22
教教我吧
作者: ada1    时间: 2006-7-7 01:01
让我看看.
作者: keenfox    时间: 2006-7-7 20:39
78889


作者: 罗生门    时间: 2006-7-8 01:53
谢谢分享
作者: yangzn    时间: 2006-7-11 05:53
学习,学习
作者: zhouxinmail    时间: 2006-7-14 19:27
学习中!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
作者: wxmins    时间: 2006-7-16 10:10
哦我也看过类似的的例子,不过没有可以用键盘移动的   
作者: wailing    时间: 2006-7-18 21:54
支持一个
作者: 84599479    时间: 2006-7-18 22:17
afasf a
作者: lirong    时间: 2006-7-19 16:14
樓主太不厚道。逼我們灌水。看看先。
作者: zouwenshan    时间: 2006-7-19 17:04
标题: 不错
不错


作者: 文棣    时间: 2006-7-19 18:59
学习学习
作者: 左耳    时间: 2006-7-20 00:27
说说,偶要看看[em02]
作者: 华哥    时间: 2006-7-20 23:12
[em01]vb kb ,
作者: ceanry    时间: 2006-7-21 00:53
我也是菜鸟,要发文
作者: chinshu    时间: 2006-7-23 22:50
先回复,看看再说
作者: jeam    时间: 2006-7-24 00:28
来看看
作者: 蟋蟀的蟀    时间: 2006-7-24 03:41
太好了
作者: forchina    时间: 2006-7-24 06:54
?
作者: annelqp    时间: 2006-7-25 05:27

作者: 小何    时间: 2006-7-27 18:44
88
作者: libendong    时间: 2006-7-27 19:59
look
作者: qun0606    时间: 2006-7-28 03:30
看看
作者: szbgj    时间: 2006-7-28 16:43
学习


作者: yzt2005    时间: 2006-7-31 21:00
gvszfsdfsafdsafdsafasfdafda
作者: forid    时间: 2006-8-17 20:25
我就喜欢代码少,速度快的
作者: ahlch    时间: 2006-8-18 02:38
看看,不知道好不好
作者: 大大白菜    时间: 2006-8-18 16:03
标题: 太好了
我也来学学
作者: appleking    时间: 2006-8-18 22:32
[em02][em02]
作者: darkromeo    时间: 2006-8-19 05:13
多谢多谢
作者: shouan    时间: 2006-8-20 15:45
look


作者: yjisme    时间: 2006-8-24 15:57
东西好,要回复不好!
作者: lyqbbs    时间: 2006-8-24 16:50
我的求知欲很强阿!
作者: njguojiyong    时间: 2006-8-24 19:26

作者: zwcn    时间: 2006-8-24 21:54
okok
作者: huangqinyong    时间: 2006-8-25 01:19
I See ,ぁりがとぅ
作者: o_o_o_o_opp    时间: 2006-8-27 06:22
dd
作者: kingboyszxf    时间: 2006-8-28 20:07
嗯。。愿意学学。。
作者: nybtbt    时间: 2006-9-2 17:40
正需要,谢谢
作者: fanren    时间: 2006-9-3 04:42
学习,谢谢!
作者: df    时间: 2006-9-3 04:58
ggg
作者: FSG    时间: 2006-9-3 23:50
kan


作者: 快乐王    时间: 2006-9-4 07:17
瞅瞅
作者: lsh225    时间: 2006-9-4 21:39
頂頂頂
作者: piscesboy    时间: 2006-9-7 22:21
提示: 作者被禁止或删除 内容自动屏蔽
作者: kevindeng    时间: 2006-9-8 01:20
把图片从右边移出窗体后就再也找不回来了

[此贴子已经被作者于2006-9-7 17:24:33编辑过]


作者: renshou    时间: 2006-9-8 18:50
学习看


作者: mcy168    时间: 2006-9-8 19:48
111111111
作者: 9399100    时间: 2006-9-12 17:38
ok
作者: 在回忆中的记忆    时间: 2006-9-13 00:24
看看
作者: ywz168    时间: 2006-9-15 07:23
好,很想知道
作者: pangpangli    时间: 2006-9-16 01:17
DING
作者: goto2008    时间: 2006-9-17 04:27
?
作者: cxjcxjcxj    时间: 2006-9-19 06:18
看看
作者: zwg    时间: 2006-9-20 22:22
thank you   look
作者: 13427349911    时间: 2006-9-21 08:29
sdfsdfds
作者: in222    时间: 2006-9-21 23:16
看看
作者: in222    时间: 2006-9-21 23:17
看看
作者: 妖蛾子    时间: 2006-9-21 23:37
kankan
作者: peterpu    时间: 2006-9-23 06:05
好东本当然不能错过啦!
作者: fuyvn    时间: 2006-9-24 04:08
回, 一定要看
作者: longergh    时间: 2006-10-31 21:59
好东西呀
作者: richard_z    时间: 2006-11-3 01:30
我也看看


作者: jqm288    时间: 2006-11-4 01:45
不会做啊,教教我吧.
作者: acessnew    时间: 2006-11-7 23:23
好东东当然得顶
作者: lhs888    时间: 2006-11-8 07:18
jghjgkhj
作者: water335    时间: 2006-11-8 17:36
ding
作者: pengbodns    时间: 2006-11-16 04:19
[em01][em01][em01][em01][em01]
作者: wegolin    时间: 2006-11-16 20:20
kankan
作者: lilianban    时间: 2006-11-18 06:22
学习一下
作者: FNYCWFJ    时间: 2006-11-18 19:57
好东西
作者: zdm2003    时间: 2006-11-25 14:33
不会做啊




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3