/// <summary> /// 默认构造函数,绑定相关事件 /// </summary> public SignIn() { InitializeComponent(); //实现阴影立体效果 FormShadow.SetShadow(this); //显示登录窗体,设置焦点 this.Show(); this.SignalInButton.Focus(); this.ShowInTaskbar = false; this.TopMost = true; this.AccountPanel.Paint += AccountPanel_Paint; this.PasswordPanel.Paint += PasswordPanel_Paint; //绑定窗口移动事件 this.MouseDown += SignIn_MouseDown; this.MouseMove += SignIn_MouseMove; this.SignInPicture.MouseMove += SignIn_MouseMove; this.SignInPicture.MouseDown += SignIn_MouseDown; this.panel1.MouseMove += SignIn_MouseMove; this.panel1.MouseDown += SignIn_MouseDown; //登录相关事件绑定 this.SignalInButton.Click += SignalInButton_Click; this.AccountTextLine.Leave += AccountTextLine_Leave; //勾选自动登录->记住密码 this.AutoSignInCheckBox.CheckedChanged += AutoSignInCheckBox_CheckedChanged; //取消记住密码->取消自动登录 this.PasswordCheckBox.CheckedChanged += PasswordCheckBox_CheckedChanged; }
/// <summary> /// 默认构造函数 /// </summary> public ChatForm() { InitializeComponent(); //实现阴影立体效果 FormShadow.SetShadow(this); DefineEvent(); this.ShowInTaskbar = true; //绘制圆角函数 //this.SetWindowRegion(5); //绑定事件 this.MouseMoveEvent += ChatForm_MouseMove; this.MouseDownEvent += ChatForm_MouseDown; this.SizeChanged += ChatForm_SizeChanged; this.TopPanel.DoubleClick += TopPanel_DoubleClick; this.SearchTextBox.LostFocus += SearchTextBox_LostFocus; this.SearchTextBox.Click += SearchTextBox_Click; this.SearchTextBox.TextChanged += SearchTextBox_TextChanged; this.AccountOppositeChange += ChatForm_AccountOppositeChange; this.NewsEditRichTextBox.KeyDown += NewsEditRichTextBox_KeyDown; this.ReceiveNewsEvent += ChatForm_ReceiveNewsEvent; //绘制虚线条事件,美化 this.TopLeftPanel.Paint += TopLeftPanel_Paint; this.RightPanel.Paint += RightPanel_Paint; this.ButtonFunctionPanel.Paint += ButtonFunctionPanel_Paint; this.RightBottomPanel.Paint += RightBottomPanel_Paint; }
/// <summary> /// 默认构造函数 /// </summary> public MainForm() { InitializeComponent(); //绑定顶层关闭程序事件处理 CommonEvent.CloseProgramEvent += CommonEvent_CloseProgramEvent; //实现阴影立体效果 FormShadow.SetShadow(this); this.TopMost = true;//设置为顶级窗口 this.BottomPanel.Paint += BottomPanel_Paint; //设置右下角图标 this.BottomRightIcon.Icon = GrayIcon; this.BottomRightIcon.Click += BottomRightIcon_Click; this.BottomRightIcon.Visible = true; //连接远程通信服务器 if (!CallServer.InitCallServer()) { System.Environment.Exit(1); } //初始化聊天界面 this.chatForm = new ChatForm(); this.chatForm.Visible = false; chatForm.FormClosed += ChatForm_FormClosed; //绑定双击打开聊天记录事件 this.DownForm.RequestChat += DownForm_RequestChat; //实例化闹钟,用来显示消息 ShowNewsTimer = new System.Windows.Forms.Timer(); ShowNewsTimer.Interval = 500; ShowNewsTimer.Enabled = false; //实例化登录界面 signInForm = new SignIn(); signInForm.Show(); signInForm.ShowInTaskbar = false; //显示托盘图标,放在这里,通过默认图标为不显示,防止图标重复出现 this.BottomRightIcon.Visible = true; //绑定相关事件 ConnectEvent(); //初始化登录界面 signInForm.init(); }