C # implement hidden floating forms and message flashing similar to QQ
Features
When the voice customer service system successfully logs on to the main interface, this chat tool is automatically hidden in the lower left corner. When you move the mouse to the lower left corner, the tool is automatically displayed. When you move the mouse away from the chat form, the tool is automatically hidden. If you want to fix the chat form on the desktop, you just need to drag the chat window and keep it at the boundary position. Hidden and suspended QQ.
1. Main System Interface
When you click the Minimize button, the task icon is displayed in the lower right corner of the computer, click the task icon vcfOu9bDta + supervisor + a497K/supervisor + CjxwPmEpIM/Supervisor/supervisor + z/supervisor + Yikgt6LLzc/Supervisor/7z6K9 + supervisor + 8 + Supervisor/LV37Xju/Supervisor/supervisor + Supervisor /Iy9Sxo7rP1Mq + y/nT0NLRtcfCvL/Nt/7Ptc2ztcTX + M + CTX + zckgza1_qqo6vmfcvnf4z6/Jz8/Cz9 + placement/placement = "brush: java; "> # region dock internal AnchorStyles StopDock = AnchorStyles. none; private void StopRectTimer_Tick (object sender, EventArgs e) {// if the mouse is on the form, the entire form if (this. bounds. contains (Cursor. position) {switch (this. stopDock) {case AnchorStyles. top: this. location = new Point (this. location. x, 0); break; case AnchorStyles. bottom: this. location = new Point (this. location. x, Screen. primaryScreen. bounds. height-this. height); break; case AnchorStyles. left: this. location = new Point (0, this. location. y); break; case AnchorStyles. right: this. location = new Point (Screen. primaryScreen. bounds. width-this. width, this. location. y); break ;}} else // If the mouse leaves the form, the form is hidden based on the position of the dock, but some forms must be left at the edge so that the mouse can select the form {switch (this. stopDock) {case AnchorStyles. top: this. location = new Point (this. location. x, (this. height-3) * (-1); break; case AnchorStyles. bottom: this. location = new Point (this. location. x, Screen. primaryScreen. bounds. height-5); break; case AnchorStyles. left: this. location = new Point (-1) * (this. width-3), this. location. y); break; case AnchorStyles. right: this. location = new Point (Screen. primaryScreen. bounds. width-2, this. location. y); break ;}} private void MainFrm_LocationChanged (object sender, EventArgs e) {if (this. top <= 0) {this. stopDock = AnchorStyles. top;} else if (this. bottom> = Screen. primaryScreen. bounds. height) {this. stopDock = AnchorStyles. bottom;} else if (this. left <= 0) {this. stopDock = AnchorStyles. left;} else if (this. left> = Screen. primaryScreen. bounds. width-this. width) {this. stopDock = AnchorStyles. right;} else {this. stopDock = AnchorStyles. none; }}# endregion
When there is a message, the icon is flashing constantly, adding a timer, constantly switching the icon, listening, and message list. If there is a text change, the timer is enabled.
Int I = 0; // first set a global variable I to control the image index, and then create a scheduled event, double-click the timer control to edit private Icon ico1 = new Icon ("img/q1.ico"); private Icon ico2 = new Icon ("img/q2.ico "); // switch between the two icons to achieve message flashing effect // The private void timereffectick (object sender, EventArgs e) {// if I = 0, make the taskbar icon transparent and exit if (I <1) {this. notifyIcon1.Icon = ico2; I ++; return ;}// if I! = 0, the taskbar icon is changed to ico1, And I is set to 0; else this. policyicon1.icon = ico1; I = 0;} // when a message is sent, the private void ChatRoomMsg_TextChanged (object sender, EventArgs e) {this. timer1.Enabled = true;} private void policyicon1_mouseclick (object sender, MouseEventArgs e) {if (this. timer1.Enabled) {this. timer1.Enabled = false;} if (e. button = MouseButtons. left & this. windowState = FormWindowState. minimized) {// determine whether the tray is Minimized if (WindowState = FormWindowState. minimized) {this. stopRectTimer. enabled = false; StopDock = AnchorStyles. none; // restore window display WindowState = FormWindowState. normal; // activate the form and give it focus // this. activate (); // display the icon this in the taskbar. showInTaskbar = false; // hide the tray area icon // export yicon1.visible = true; // this is displayed in the lower left corner by default. left = 0; this. top = Screen. primaryScreen. workingArea. height-this. height ;}}}