//仿QQ登录界面
import win.ui; 
import win.ui.menu
import process;
/*DSG{{*/
var winform = win.form(parent=...; bgcolor=16708835;bottom=226;max=false;right=350;exmode="";text="AAuto_UI_QQ2010";style=0;cls="AAuto_QQ2010" )
winform.add( 
checkbox={ dl=1;bgcolor=16708835;bottom=172;color=0;text="记住密码";left=126;dt=1;top=152;acceptfiles=1;z=5;checked=1;right=192;tabstop=1;cls="checkbox" };
edit2={ dl=1;bgcolor=16777215;color=0;right=248;left=84;dt=1;cls="edit";password=1;bottom=130;text="AAuto Studio";top=109;acceptfiles=1;z=16;edge=1;tabstop=1 };
picturebox2={ dl=1;bgcolor=14215660;color=0;right=352;left=-1;dt=1;image=$"\.res\logon.jpg";cls="picturebox";z=3;bottom=57;text="picturebox2";top=-4;acceptfiles=1;transparent=1;tabstop=1 };
picturebox_floating={ dl=1;bgcolor=14215660;notify=1;color=0;right=111;left=80;dt=1;image=$"\.res\state.jpg";cls="picturebox";z=4;bottom=172;text="picturebox_floating";top=152;acceptfiles=1;tabstop=1;transparent=1 };
checkbox2={ dl=1;bgcolor=16577509;bottom=172;color=0;text="自动登录";left=209;dt=1;top=152;acceptfiles=1;z=8;right=275;tabstop=1;cls="checkbox" };
static={ dl=1;bgcolor=14215660;bottom=92;color=0;right=84;left=37;dt=1;top=72;acceptfiles=1;tabstop=1;text="账 号：";transparent=1;z=6;cls="static" };
static4={ dl=1;bgcolor=14215660;notify=1;color=16711680;right=331;left=266;dt=1;cls="static";transparent=1;bottom=134;text="找回密码";top=114;acceptfiles=1;z=9;tabstop=1 };
button3={ dl=1;bgcolor=14215660;color=0;right=324;left=248;dt=1;cls="button";tabstop=1;bottom=216;align="";text="登 录";top=193;acceptfiles=1;z=10;transparent=1 };
static5={ dl=1;bgcolor=14215660;bottom=174;color=0;right=83;left=36;dt=1;top=154;acceptfiles=1;tabstop=1;text="状 态：";transparent=1;z=7;cls="static" };
button2={ flat=1;bgcolor=14215660;color=0;right=335;left=310;dt=1;dl=1;cls="button";z=1;bottom=177;align="";text="5";top=157;font=LOGFONT( name="Webdings";charset=2;out=3;family=18;clip=2;quality=1 );acceptfiles=1;transparent=1;tabstop=1 };
static3={ dl=1;bgcolor=14215660;notify=1;color=16711680;right=331;left=266;dt=1;cls="static";transparent=1;bottom=97;text="注册新账号";top=77;acceptfiles=1;z=11;tabstop=1 };
static2={ dl=1;bgcolor=14215660;bottom=137;color=0;right=84;left=37;dt=1;top=117;acceptfiles=1;tabstop=1;text="密 码：";transparent=1;z=12;cls="static" };
button={ dl=1;bgcolor=14215660;color=0;right=99;left=23;dt=1;cls="button";tabstop=1;bottom=216;align="";text="设 置";top=193;acceptfiles=1;z=13;transparent=1 };
picturebox={ dl=1;bgcolor=16379852;bottom=223;color=0;text="▲";left=0;dt=1;top=182;acceptfiles=1;z=15;right=347;tabstop=1;cls="picturebox" };
button4={ dl=1;bgcolor=14215660;color=0;right=114;left=79;dt=1;image=$"\.res\state.jpg";cls="button";bottom=169;align="";text="button4";top=152;acceptfiles=1;tabstop=1;z=14 };
combobox={ dl=1;bgcolor=14215660;color=0;right=249;left=85;dt=1;mode="dropdown";cls="combobox";tabstop=1;bottom=91;text="combobox";
items={ "829056" };acceptfiles=1;transparent=1;top=71;edge=1;z=2 }
)
/*}}*/

var m_isover_floatingbtn = false;
winform.wndproc = function(hwnd,message,wParam,lParam){
	select(message) { 
		case 0x200/*_WM_MOUSEMOVE*/  {
	    		winform.picturebox_floating.hide= false;
	    		winform.button4.hide= true;
	    		if(m_isover_floatingbtn){ 
	    	    	m_isover_floatingbtn= false;
	    	    	winform.redraw();
	    		}
    	}   
	}
}

winform.picturebox_floating.wndproc = function(hwnd,message,wParam,lParam){
	select(message) {
		case 0x200/*_WM_MOUSEMOVE*/ {
	    	winform.picturebox_floating.hide= true;
	    	winform.button4.hide= false;
	    	m_isover_floatingbtn = true;
		}   
	} 
}

winform.button4.oncommand = function(id,event){ 
	var popmenu1 = win.ui.popmenu(winform);
	popmenu1.add('我在线上',function(){win.msgbox("我在线上!","AAuto UI Demo" )});
	popmenu1.add('Q 我吧',function(){win.msgbox("Q 我吧!","AAuto UI Demo" )});
	popmenu1.add();
	popmenu1.add('离 开',function(){win.msgbox("离 开!","AAuto UI Demo" )});
	popmenu1.add('忙 碌',function(){win.msgbox("忙 碌!","AAuto UI Demo" )});
	popmenu1.add('请勿打扰',function(){win.msgbox("请勿打扰!","AAuto UI Demo" )});
	popmenu1.add();
	popmenu1.add('隐 身',function(){win.msgbox("隐 身!","AAuto UI Demo" )});
	//添加按钮弹出菜单

	popmenu1.popup(winform.button4.right - 34 ,winform.button4.bottom); 
}

winform.button4.hide= true; 

winform.button3.oncommand = function(id,event){ 
	var userID = winform.combobox.text;
	var userPW = winform.edit2.text;
	var strTemp = string.format( '帐号是: %s\r\n密码是: %s', userID,userPW);
	win.msgbox(strTemp ,"AAuto_UI_DEMO" ); 
}

winform.static4.oncommand = function(id,event){ 
	process.execute("http://www.ecranesoft.com/bbs")
}

winform.static3.oncommand = function(id,event){ 
	process.execute("http://www.ecranesoft.com/bbs")
}

var set = false;
winform.button2.oncommand = function(id,event){
	//win.msgbox( winform.button2.text );
	winform.button.hide= true;
	winform.button3.hide= true;
	var rc = ::RECT();
	
	if(!set){
		winform.button.hide= true;
		winform.button3.hide= true;
		::GetWindowRect( winform.hwnd,rc );
		::MoveWindow(winform.hwnd,rc.left,rc.top,rc.right - rc.left,rc.bottom - rc.top -40,1);
		set = true;
		winform.button2.text = "6"
	}
	else{ 
		winform.button.hide= false;
		winform.button3.hide= false;
		::GetWindowRect( winform.hwnd,rc );
		::MoveWindow(winform.hwnd,rc.left,rc.top,rc.right - rc.left,rc.bottom - rc.top +40,1);
		set = false;
		winform.button2.text = "5"
	} 
}

winform.show(true) 
win.loopMessage( winform );
