aardio 文档
aardio 范例: 桌面图标排圆圈
//桌面图标排圆圈
//根据 4920614 代码修改 http://www.aardio.com/bbs/showtopic-9744.aspx
import winex;
import win.ui;
/*DSG{{*/
var winform = win.form(text="桌面图标排圆圈";right=333;bottom=93;parent=...)
winform.add(
autoOrder={cls="button";text="恢复自动排列";left=203;top=46;right=316;bottom=72;font=LOGFONT(name='宋体');z=2};
button={cls="button";text="桌面图标排个圈圈";left=202;top=10;right=315;bottom=36;font=LOGFONT(name='宋体');z=1};
editR={cls="edit";text="300";left=119;top=12;right=170;bottom=34;edge=1;font=LOGFONT(name='宋体');z=3};
static={cls="static";text="圈圈半径(px):";left=33;top=17;right=111;bottom=33;font=LOGFONT(name='宋体');transparent=1;z=4}
)
/*}}*/
//注意不支持替换了系统桌面的各种 XX 桌面。
import winex.desktop;
winform.button.oncommand = function(id,event){
//取消桌面右键对齐到网格
winex.desktop.listview.setExtended(0x80000/*_LVS_EX_SNAPTOGRID*/,false);
//取消桌面自动排列
winex.desktop.listview.modifyStyle(0x100/*_LVS_AUTOARRANGE*/);
var scrWidth,scrHeight = win.getScreen()
var centerX = scrWidth/2;
var centerY = scrHeight/2;
var r = math.min(
tonumber(winform.editR.text),
math.min(centerX,centerY)
)
//桌面图标个数
var count = winex.desktop.listview.count;
//相邻图标间的弧度 2π/count
var rad = 2*math.pi/count;
for(i=1;count ){
var x=centerX+math.floor(r*math.sin(i*rad));
var y=centerY+math.floor(r*math.cos(i*rad));
winex.desktop.listview.setItemPos(i,x,y);
win.delay(10);
}
}
//恢复自动排列
winform.autoOrder.oncommand = function(id,event){
winex.desktop.listview.modifyStyle( , 0x100/*_LVS_AUTOARRANGE*/ );
winex.desktop.listview.setExtended(0x80000/*_LVS_EX_SNAPTOGRID*/,true)
}
winform.show();
win.loopMessage();
Markdown 格式