標籤:style blog http color os width
功能簡介
當語音客服系統登入成功進入主介面時,本聊天工具將會自動隱藏在左下角位置,當滑鼠移動到左下角時,自動彈出,當滑鼠移開聊天表單時,自動隱藏。如果想讓聊天表單固定在案頭,只要拖動一下聊天視窗,讓它不停留在邊界位置就可以了。隱藏和懸浮方式類型QQ。
1. 系統主介面
當點擊最小化按鈕時, 在電腦右下角會顯示任務表徵圖,點擊任務表徵圖,將會在左下角位置彈出。
主介面各部分介紹:
a) 訊息列表:該地區的功能主要是顯示訊息記錄。
b) 發送訊息:輸入要發送的訊息進行發送,預設群聊,輸入訊息後,按斷行符號鍵或者點擊“發送”按鈕,將進行訊息發送。
c) 坐席人員:顯示所有已登入客服系統的坐席人員,顯示方式:名稱(狀態)
d) 通知:記錄坐席上下線記錄
實現浮動:
#region 停靠懸浮 internal AnchorStyles StopDock = AnchorStyles.None; private void StopRectTimer_Tick(object sender, EventArgs e) { //如果滑鼠在表單上,則根據固定位置顯示整個表單 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 //如果滑鼠離開表單,則根據固定位置隱藏表單,但須留出部分表單邊緣以便滑鼠選中表單 { 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
有訊息來時,不斷閃動表徵圖,添加一個定時器,不斷切換該表徵圖,監聽,訊息列表,如果有文字改變,則開啟定時器。
int i = 0; //先設定一個全域變數 i ,用來控製圖片索引,然後建立定時事件,雙擊定時控制項就可以編輯 private Icon ico1 = new Icon("img/q1.ico"); private Icon ico2 = new Icon("img/q2.ico"); //兩個表徵圖 切換顯示 以達到訊息閃動的效果 //定時器 不斷閃動表徵圖 private void timer1_Tick(object sender, EventArgs e) { //如果i=0則讓工作列表徵圖變為透明的表徵圖並且退出 if (i < 1) { this.notifyIcon1.Icon = ico2; i++; return; } //如果i!=0,就讓工作列表徵圖變為ico1,並將i置為0; else this.notifyIcon1.Icon = ico1; i = 0; } //有訊息來時 閃動 private void ChatRoomMsg_TextChanged(object sender, EventArgs e) { this.timer1.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) { //判斷是否已經最小化於托盤 if (WindowState == FormWindowState.Minimized) { this.StopRectTimer.Enabled = false; StopDock = AnchorStyles.None; //還原表單顯示 WindowState = FormWindowState.Normal; //啟用表單並給予它焦點 //this.Activate(); //工作列區顯示表徵圖 this.ShowInTaskbar = false; //托盤區表徵圖隱藏 //notifyIcon1.Visible = true; //預設顯示 左下角 this.Left = 0; this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height; } } }