C # implements a QQ-like hidden floating form, message flashing

Source: Internet
Author: User

Feature Introduction

When the Voice customer service System login successfully entered the main interface, this chat tool will automatically hide in the lower left corner, when the mouse moves to the lower left corner, automatically pop up, when the mouse moved the chat form, automatically hidden. If you want the chat form to be pinned to the desktop, just drag the chat window so that it doesn't stay on the border. Hide and hover mode type QQ.


1. System Main Interface

When you click the Minimize button, the task icon appears in the lower-right corner of the computer, and clicking on the task icon pops up in the lower-left corner.

The main interface sections describe:

A) message list: The function of this area is mainly to display the message record.

b) Send message: Enter the message to send, default group chat, enter the message, press ENTER or click "Send" button, will send a message.

c) Agent: Displays all the agents who have logged in to the customer service system, displayed by: Name (status)

d) Notice: Record the log on the agent's downline

To implement a float:

        #region Docking suspension internal anchorstyles stopdock = Anchorstyles.none; private void Stoprecttimer_tick (object sender, EventArgs e) {//If the mouse is on a form, the entire form is displayed according to the docking position if (th Is. 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, hides the form according to the docking location, but leaves part of the form edge so that the mouse selects 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 (th Is.           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 a message comes in, keep flashing the icon, add a timer, constantly switch the icon, listen, message list, if there is text change, then turn on the timer.

        int i = 0; Set a global variable I, to control the image index, and then create a timed event, double-click the Timer control can be edited         private icon Ico1 = new Icon (" Img/q1.ico ");         private Icon Ico2 = new icon ("Img/q2.ico");            Two icons toggle display to achieve message flashing effect//timer flashing icon private void Timer1_Tick (object sender, EventArgs e) {                If i=0 makes the taskbar icon transparent and exits if (I < 1) {This.notifyIcon1.Icon = Ico2;                i++;            Return            }//If i!=0, let the taskbar icon change to Ico1 and set I to 0;            else This.notifyIcon1.Icon = Ico1;         i = 0; }//There is a message flashing private void chatroommsg_textchanged (object sender, EventArgs e) {This.timer        1.Enabled = true; }      private void Notifyicon1_mouseclick (object sender, MouseEventArgs e)          {            if (this.timer1.Enabled)             {                 this.timer1.Enabled = false;            }             if (E.button = = MouseButtons.Left && this. WindowState = = formwindowstate.minimized)             {                //Judging if it has been minimized in pallets                  if (WindowState = = formwindowstate.minimized)                  {                     this. stoprecttimer.enabled = False;                     Stopdock = anchorstyles.none;                    //Restore form display                      WindowState = formwindowstate.normal;                    //Activate the form and give it focus                     //this. Activate ();                    //taskbar area display Icons                      this. ShowInTaskbar = false;                   //Tray area icon Hide                     //notifyicon1.visible = true;                     //default display lower left corner                      this. left = 0;                     this. Top = Screen.primaryscreen.workingarea.height-this. height;               }            }       }


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.