private void tbChat_ButtonClick(object sender, ToolBarButtonClickEventArgs e) { switch (e.Button.Name) { case "tbBtnFont": fontDialog.Font = rtbMessage.Font; fontDialog.Color = rtbMessage.ForeColor; if (fontDialog.ShowDialog() == DialogResult.OK) { rtbMessage.Font = fontDialog.Font; rtbMessage.ForeColor = fontDialog.Color; } break; case "tbBtnSmiley": tbBtnSmiley.Pushed = true; Point pos = new Point(tbBtnSmiley.Rectangle.Left, tbBtnSmiley.Rectangle.Bottom); mnuSmiley.Show(tbChat, pos, tbBtnSmiley.Rectangle); tbBtnSmiley.Pushed = false; break; case "tbBtnSave": saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); saveFileDialog.FileName = string.Empty; if (saveFileDialog.ShowDialog() == DialogResult.OK) { rtbMessageHistory.SaveFile(saveFileDialog.FileName); } break; case "tbBtnSendFile": //openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); openFileDialog.FileName = string.Empty; if (openFileDialog.ShowDialog() == DialogResult.OK) { ChatArgs chatArgs = new ChatArgs(DatagramTypes.File, key, openFileDialog.FileName); Sending(this, chatArgs); } break; case "tbBtnPop": WindowModeEvents windowEvent = bWindowed ? WindowModeEvents.PopIn : WindowModeEvents.PopOut; WindowModeArgs windowModeArgs = new WindowModeArgs(key, windowEvent); tbChat.ShowToolTips = false; tbPop.ShowToolTips = false; WindowModeChange(this, windowModeArgs); break; } rtbMessage.Focus(); }
public WindowModeArgs(string key, WindowModeEvents windowEvent) { this.key = key; this.windowEvent = windowEvent; }