◇[DELPHI]产生鼠标拖动效果 通过MouseMove事件、DragOver事件、EndDrag事件实现,例如在PANEL上的LABEL: var xpanel,ypanel,xlabel,ylabel:integer; PANEL的MouseMove事件:xpanel:=x;ypanel:=y; PANEL的DragOver事件:xpanel:=x;ypanel:=y; LABEL的MouseMove事件:xlabel:=x;ylabel:=y; LABEL的EndDrag事件:label.left:=xpanel-xlabel;label.top:=ypanel-ylabel;
◇[DELPHI]取得WINDOWS目录 uses shellapi; var windir:array[0..255] of char; getwindowsdirectory(windir,sizeof(windir)); 或者从注册表中读取,位置: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion SystemRoot键,取得如:C:\WINDOWS
◇[DELPHI]在form或其他容器上画线 var x,y:array [0..50] of integer; canvas.pen.color:=clred; canvas.pen.style:=psDash; form1.canvas.moveto(trunc(x[i]),trunc(y[i])); form1.canvas.lineto(trunc(x[j]),trunc(y[j]));
◇[DELPHI]字符串列表使用 var tips:tstringlist; tips:=tstringlist.create; tips.loadfromfile('filename.txt'); edit1.text:=tips[0]; tips.add('last line addition string'); tips.insert(1,'insert string at NO 2 line'); tips.savetofile('newfile.txt'); tips.free;
◇[DELPHI]处理文件属性 attr:=filegetattr(filelistbox1.filename); if (attr and faReadonly)=faReadonly then ... //只读 if (attr and faSysfile)=faSysfile then ... //系统 if (attr and faArchive)=faArchive then ... //存档 if (attr and faHidden)=faHidden then ... //隐藏