예제 #1
0
        //“登录”
        private void tb2_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            //"登录"使用被禁止
            this.tb2.IsHitTestVisible = false;
            ChildWindow1 mycw = new ChildWindow1();

            mycw.Show();
            //设置子窗口关闭事件代码
            mycw.Closed += new EventHandler(mycw_Closed);
        }
예제 #2
0
        //子窗口登录关闭事件
        private void mycw_Closed(object sender, EventArgs e)
        {
            ChildWindow1 cwsender = (ChildWindow1)sender;

            if ((bool)cwsender.DialogResult)
            {
                this.textblock1.Text  = "用户“" + cwsender.textbox1.Text.ToString() + "”登录成功!";
                this.image.Visibility = Visibility.Visible;
                this.Storyboard1.Begin();
            }
            else
            {
                System.Windows.MessageBox.Show("取消登录!");
                this.tb2.IsHitTestVisible = true;
            }
        }