1.请问如何让外部程序的窗体在我的VB程序窗体上面显示?
2.nestable lists 如何禁止拖动
3.让一个应用程序在指定的窗体中运行
4.å¦ä½å¨XMLä¸ä½¿ç¨èªå®ä¹Animationå¨ç»ç±»
请问如何让外部程序的窗体在我的VB程序窗体上面显示?
'添加控件Command1,以下是代码
'API函数: 设置窗口的新父窗口
PrivateDeclare Function SetParent Lib "user" ( _
ByVal hWndChild As Long, _
Private Sub Command1_Click()
Dim hwnd As Long, hWndNewParent As Long
'hwnd = 你要设置的窗口句柄,句柄可以用API或者是APY++获得
'hWndNewParent = 你要设置的父窗口句柄,句柄可以用API或者是APY++获得
'设置hWndNewParent 为 hwnd 的父窗口
SetParent hwnd, hWndNewParent
End Sub
nestable lists 如何禁止拖动
我改了下源码,加了个allowDrag的属性$("#showModuleInfo").nestable({ allowDrag:false}) //禁止拖拽
加了个refresh的方法,主要用在自己append节点的时候,前面的+-button能刷出来
$("#moduleInfo").nestable("refresh");//
这里传不了附件,把改动截图贴上来了,自己对着jquery.nestable.js改一下吧,框起来的是我动过的,没框的都是原来的
var defaults = {
listNodeName: 'ol',
itemNodeName: 'li',
rootClass: 'dd',
listClass: 'dd-list',
itemClass: 'dd-item',
dragClass: 'dd-dragel',
handleClass: 'dd-handle',
collapsedClass: 'dd-collapsed',
placeClass: 'dd-placeholder',
noDragClass: 'dd-nodrag',
emptyClass: 'dd-empty',
expandBtnHTML: '<button data-action="expand" type="button">Expand</button>',
collapseBtnHTML: '<button data-action="collapse" type="button">Collapse</button>',
group: 0,
maxDepth: 5,
threshold: ,
allowDrag:true
};
---------------------------------------
if(this.options.allowDrag){
list.el.on('mousedown', onStartEvent);
list.w.on('mousemove', onMoveEvent);
list.w.on('mouseup', onEndEvent);
}
--------------------------------------
refresh:function(){
var list=this;
list.el.find(list.options.itemNodeName).each(function() {
$(this).children('[data-action]').remove();
if($(this).find(list.options.listNodeName).children().length>0){
list.setParent($(this));
}else{
list.unsetParent($(this));
}
});
},
让一个应用程序在指定的窗体中运行
以计算器程序为例,建Command1。企业源码建站代码如下 。论道 源码
=====================
Option Explicit
Private Declare Function SetParent Lib "user" (ByVal hWndChild As Long,mnn源码 ByVal hWndNewParent As Long) As Long
Private Declare Function FindWindow Lib "user" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Shell "calc"
SetParent FindWindow("SciCalc", vbNullString), hWnd
End Sub
å¦ä½å¨XMLä¸ä½¿ç¨èªå®ä¹Animationå¨ç»ç±»
å¨å®ååºç¨çå¨ç»å¼åä¸ï¼å¯è½SDKä¸èªå¸¦çè¡¥é´å¨ç»ä¸è½æ»¡è¶³åºç¨çéæ±ï¼éè¦å¨Java代ç ä¸èªå®ä¹ä¸äºå¨ç»ç±»ï¼å½ç¶é½æ¯ç»§æ¿èªAnimationç±»ãå®ç°ä¹åï¼æ们ä¸è¬ç´æ¥å¨ä»£ç ä¸ä½¿ç¨ï¼ç±»ä¼¼ä¸é¢è¿æ ·ï¼CustomAnimationcustomAnimation=newCustomAnimation();customAnimation.setDuration();customAnimation.setFillAfter(true);effectView.startAnimation(customAnimation);å½Viewåæ¶è¦åºç¨åScaleï¼Alphaè¿æ ·çè¡¥é´å¨ç»æ¶ï¼ä½ å°±éè¦å¤æ·»å 类似ä¸é¢ç代ç ï¼CustomAnimationcustomAnimation=newCustomAnimation();customAnimation.setDuration();customAnimation.setFillAfter(true);AnimationscaleAnimation=newScaleAnimation(0f,1f,0f,1f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);AnimationalphaAnimation=newAlphaAnimation(0.1f,1.0f);scaleAnimation.setDuration();alphaAnimation.setDuration();AnimationSetset=newAnimationSet(true);set.addAnimation(customAnimation);set.addAnimation(scaleAnimation);set.addAnimation(alphaAnimation);set.setFillAfter(true);set.setFillEnabled(true);effectView.startAnimation(set);å¦æç´æ¥å¨xmlä¸ææéçææè¡¥é´å¨ç»ï¼å æ¬èªå®ä¹å¨ç»ç±»æ¾å°ä¸ä¸ªéåï¼äºæ çèµ·æ¥å°±æ²¡é£ä¹å¤æãå¨xmlå®ä¹å¥½å¨ç»éæ两个好å¤ï¼ä½¿ç¨å¨ç»æ¶éè¦æ´å°çJava代ç ï¼æ´ä½ä¸çä¸å»æ´å¹²åå¨xmlä¸å®ä¹ï¼å个å¨ç»å±æ§ä¸ç®äºç¶ä¹æ´éä¸ï¼æ¹ä¾¿é 读ä¸ç»´æ¤æ¢ç¶æè¿æ ·ç好å¤ï¼æ们就å¼å§å¹²å§ãé¦å å¨xmlä¸åä¸é¢è¿æ ·å®ä¹ä¸ä¸ªå¨ç»éï¼R.anim.my_anim_setmyapp:customProp2=""myapp:customProp3="%"android:duration=""android:fillAfter="true"/>ç¶åï¼æ们æç §å¸¸çæ¥ï¼å¨Java代ç ä¸è¿æ ·æ¥å è½½æ们å®ä¹çxmlå¨ç»éï¼AnimationSetset=(AnimationSet)AnimationUtils.loadAnimation(this,R.anim.my_anim_set);effectView.startAnimation(set);ä½æ¯ï¼æ±æï¼ä¸é¢ç代ç æ¯ä¸æ£ç¡®æ§è¡ï¼è¿è¡èµ·æ¥ç¨åºä¼ç´æ¥ç»æ¢ãé£ä»ä¹åå å¢ï¼æ¥çAnimationUtils.loadAnimationæºä»£ç æ们ç¥éï¼å¨å ¶ä»xmlè½½å ¥å¨ç»ç±»çæ¶åï¼åªè®¤alphaãscaleãrotateãtranslateè¿å 个SDKèªå¸¦çå¨ç»ç±»ï¼èæ们åå ¥çèªå®ä¹å¨ç»ç±»CustomAnimationä¼å¯¼è´å ¶æ¥Unknownanimationnameçå¼å¸¸ãå®æ¹SDKä¹æ²¡ææä¾è§£å³è¿ä¸ªé®é¢çå ¶ä»APIæ¹æ³ï¼é£ä¹æä¹è§£å³å¢ï¼å¾ç®åï¼åªéå¨åæçAnimationUtils.loadAnimationæºç ä¸æ¹å¨ä¸è¡ï¼ä»ClassLoaderè½½å ¥èªå®ä¹å¨ç»ç±»å³å¯ãå°å ¶æºç æ·è´è¿æ¥ï¼å®ç°ä¸ä¸ªèªå·±çloadAnimationæ¹æ³ï¼å¦ä¸ï¼OptAnimationLoader.javapublicclassOptAnimationLoader{ publicstaticAnimationloadAnimation(Contextcontext,intid)throwsResources.NotFoundException{ XmlResourceParserparser=null;try{ parser=context.getResources().getAnimation(id);returncreateAnimationFromXml(context,parser);}catch(XmlPullParserExceptionex){ Resources.NotFoundExceptionrnf=newResources.NotFoundException("Can'tloadanimationresourceID#0x"+Integer.toHexString(id));rnf.initCause(ex);throwrnf;}catch(IOExceptionex){ Resources.NotFoundExceptionrnf=newResources.NotFoundException("Can'tloadanimationresourceID#0x"+Integer.toHexString(id));rnf.initCause(ex);throwrnf;}finally{ if(parser!=null)parser.close();}}privatestaticAnimationcreateAnimationFromXml(Contextc,XmlPullParserparser)throwsXmlPullParserException,IOException{ returncreateAnimationFromXml(c,parser,null,Xml.asAttributeSet(parser));}privatestaticAnimationcreateAnimationFromXml(Contextc,XmlPullParserparser,AnimationSetparent,AttributeSetattrs)throwsXmlPullParserException,IOException{ Animationanim=null;//Makesureweareonastarttag.inttype;intdepth=parser.getDepth();while(((type=parser.next())!=XmlPullParser.END_TAG||parser.getDepth()>depth)&&type!=XmlPullParser.END_DOCUMENT){ if(type!=XmlPullParser.START_TAG){ continue;}Stringname=parser.getName();if(name.equals("set")){ anim=newAnimationSet(c,attrs);createAnimationFromXml(c,parser,(AnimationSet)anim,attrs);}elseif(name.equals("alpha")){ anim=newAlphaAnimation(c,attrs);}elseif(name.equals("scale")){ anim=newScaleAnimation(c,attrs);}elseif(name.equals("rotate")){ anim=newRotateAnimation(c,attrs);}elseif(name.equals("translate")){ anim=newTranslateAnimation(c,attrs);}else{ try{ anim=(Animation)Class.forName(name).getConstructor(Context.class,AttributeSet.class).newInstance(c,attrs);}catch(Exceptionte){ thrownewRuntimeException("Unknownanimationname:"+parser.getName()+"error:"+te.getMessage());}}if(parent!=null){ parent.addAnimation(anim);}}returnanim;}}è¿æ ·ï¼ä½¿ç¨OptAnimationLoader.loadAnimationæ¹æ³å°±å¯ä»¥ä»xmlä¸è½½å ¥å å«èªå®ä¹å¨ç»çå¨ç»éäºã