private void Screenshot() { ScreenSnapForm form = new ScreenSnapForm(this); if (form.ShowDialog() == DialogResult.OK) { if (form.image == null) { return; } QcMsgChatLog qcMsgChatLog = new QcMsgChatLog(); qcMsgChatLog.ChatID = qcMsgChatLog.MakeChatID(); qcMsgChatLog.ChatContent = this.txtMessage.Text.Trim(); qcMsgChatLog.ChatSendDate = DateTime.Now; qcMsgChatLog.Sender = this.m_szSender; qcMsgChatLog.PatientID = this.m_szPatientID; qcMsgChatLog.VisitID = this.m_szVisitID; qcMsgChatLog.Listener = this.m_szListener; qcMsgChatLog.MsgID = this.MsgID; qcMsgChatLog.MsgChatDataType = SystemData.MsgChatDataType.Image; byte[] byteChatImage = ImageAccess.Instance.ImageToBuffer(form.image, ImageFormat.Bmp); short shRet = QcMsgChatAccess.Instance.SaveQCMsgChatLog(qcMsgChatLog, byteChatImage); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("截图发送失败"); return; } SetChatContentToForm(qcMsgChatLog); this.richTextBox1.Focus(); richTextBox1.SelectionStart = richTextBox1.Text.Length; richTextBox1.ScrollToCaret(); } }
private void btnSelectImg_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "图片文件(*.PNG)|*.png"; if (dialog.ShowDialog() == DialogResult.OK) { Bitmap image = Bitmap.FromFile(dialog.FileName) as Bitmap; QcMsgChatLog qcMsgChatLog = new QcMsgChatLog(); qcMsgChatLog.ChatID = qcMsgChatLog.MakeChatID(); qcMsgChatLog.ChatContent = this.txtMessage.Text.Trim(); qcMsgChatLog.ChatSendDate = DateTime.Now; qcMsgChatLog.Sender = this.m_szListener; qcMsgChatLog.PatientID = this.m_szPatientID; qcMsgChatLog.VisitID = this.m_szVisitID; qcMsgChatLog.Listener = this.m_szSender; qcMsgChatLog.MsgChatDataType = SystemData.MsgChatDataType.Image; byte[] byteChatImage = ImageAccess.Instance.ImageToBuffer(image, ImageFormat.Bmp); short shRet = QcMsgChatAccess.Instance.SaveQCMsgChatLog(qcMsgChatLog, byteChatImage); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("截图发送失败"); return; } SetChatContentToForm(qcMsgChatLog); this.richTextBox1.Focus(); richTextBox1.SelectionStart = richTextBox1.Text.Length; richTextBox1.ScrollToCaret(); } }
private void btnSendMsg_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtMessage.Text.Trim())) { return; } QcMsgChatLog qcMsgChatLog = new QcMsgChatLog(); qcMsgChatLog.ChatID = qcMsgChatLog.MakeChatID(); qcMsgChatLog.ChatContent = this.txtMessage.Text.Trim(); qcMsgChatLog.ChatSendDate = DateTime.Now; qcMsgChatLog.Sender = this.m_szSender; qcMsgChatLog.PatientID = this.m_szPatientID; qcMsgChatLog.VisitID = this.m_szVisitID; qcMsgChatLog.Listener = this.m_szListener; qcMsgChatLog.MsgID = this.MsgID; byte[] byteChatImage = null; short shRet = QcMsgChatAccess.Instance.SaveQCMsgChatLog(qcMsgChatLog, byteChatImage); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("消息发送失败"); return; } SetChatContentToForm(qcMsgChatLog); richTextBox1.SelectionStart = richTextBox1.Text.Length; richTextBox1.ScrollToCaret(); this.txtMessage.Focus(); this.txtMessage.Clear(); }