更新粘贴乱码问题
This commit is contained in:
parent
54ec14c527
commit
305201f23e
@ -16,8 +16,8 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using MaterialSkin;
|
|
||||||
#if MD
|
#if MD
|
||||||
|
using MaterialSkin;
|
||||||
using MaterialSkin.Controls;
|
using MaterialSkin.Controls;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
using AIMS.PublicUI.UI;
|
using AIMS.PublicUI.UI;
|
||||||
using AIMSModel;
|
using AIMSModel;
|
||||||
|
using CCIS.Shared;
|
||||||
using DCSoft.Writer;
|
using DCSoft.Writer;
|
||||||
using DCSoft.Writer.Data;
|
using DCSoft.Writer.Data;
|
||||||
using DCSoft.Writer.Dom;
|
using DCSoft.Writer.Dom;
|
||||||
using DocumentManagement;
|
using DocumentManagement;
|
||||||
using DrawGraph;
|
using DrawGraph;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -18,6 +21,7 @@ namespace AIMS.OremrUserControl
|
|||||||
{
|
{
|
||||||
public partial class ucDocument : UserControl
|
public partial class ucDocument : UserControl
|
||||||
{
|
{
|
||||||
|
ILogger<ucDocument> logger = SharedContext.StaticInstance.ServiceProvider.GetService<ILoggerFactory>().CreateLogger<ucDocument>();
|
||||||
//模板Model
|
//模板Model
|
||||||
private PrintTemplate TModel = new PrintTemplate();
|
private PrintTemplate TModel = new PrintTemplate();
|
||||||
//文档Model
|
//文档Model
|
||||||
@ -43,6 +47,7 @@ namespace AIMS.OremrUserControl
|
|||||||
|
|
||||||
public ucDocument(int tempId, int docId, PatientRecord patient)
|
public ucDocument(int tempId, int docId, PatientRecord patient)
|
||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Patient = patient;
|
Patient = patient;
|
||||||
@ -250,6 +255,7 @@ namespace AIMS.OremrUserControl
|
|||||||
}
|
}
|
||||||
catch (Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
|
logger.LogError(exp,"保存文档出错");
|
||||||
MessageBox.Show(exp.Message, "提示");
|
MessageBox.Show(exp.Message, "提示");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,11 +38,47 @@ namespace DocumentManagement
|
|||||||
eet.KeyUp += Eet_KeyUp;
|
eet.KeyUp += Eet_KeyUp;
|
||||||
eet.ContentChanged += new ContentChangedEventHandler(eet_ContentChanged);
|
eet.ContentChanged += new ContentChangedEventHandler(eet_ContentChanged);
|
||||||
myEditControl.GlobalEventTemplate_Element = eet;
|
myEditControl.GlobalEventTemplate_Element = eet;
|
||||||
|
eet.ContentChanging += Eet_ContentChanging;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Eet_ContentChanging(object eventSender, ContentChangingEventArgs args)
|
||||||
|
{
|
||||||
|
if (eventSender is XTextInputFieldElement xife)
|
||||||
|
{
|
||||||
|
var txtAll = args.InsertingElements.Select(c => c.Text).ToList();
|
||||||
|
var txt = string.Concat(txtAll);
|
||||||
|
if (txtAll.Any(c=>c.Contains("<22>")))
|
||||||
|
{
|
||||||
|
|
||||||
|
var clip = Clipboard.GetText().Trim();
|
||||||
|
xife.Text = clip;
|
||||||
|
args.Cancel = true;
|
||||||
|
return;
|
||||||
|
args.InsertingElements.Clear();
|
||||||
|
args.InsertingElements.Add(new XTextStringElement() { Text = clip });
|
||||||
|
}
|
||||||
|
byte[] originalBytes = Encoding.UTF8.GetBytes(txt); // 这里使用 UTF8 是假设或猜测
|
||||||
|
string decodedString = Encoding.GetEncoding("GB2312").GetString(originalBytes); // 用其他编码尝试解码
|
||||||
|
|
||||||
|
byte[] originalBytes2 = Encoding.GetEncoding("GB2312").GetBytes(txt); // 这里使用 UTF8 是假设或猜测
|
||||||
|
string decodedString2 = Encoding.UTF8.GetString(originalBytes2); // 用其他编码尝试解码
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Eet_KeyUp(object eventSender, ElementKeyEventArgs args)
|
private void Eet_KeyUp(object eventSender, ElementKeyEventArgs args)
|
||||||
{
|
{
|
||||||
|
// 判断 Ctrl 键是否被按下
|
||||||
|
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
|
||||||
|
{
|
||||||
|
// 判断 V 键是否被按下
|
||||||
|
if (args.KeyCode == Keys.V)
|
||||||
|
{
|
||||||
|
// Ctrl+V 被按下,执行相应的操作
|
||||||
|
MessageBox.Show("Ctrl+V was pressed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (args.KeyCode == Keys.V && args.Control == true)
|
if (args.KeyCode == Keys.V && args.Control == true)
|
||||||
{
|
{
|
||||||
if ((eventSender as XTextDocument).CurrentInputField != null)
|
if ((eventSender as XTextDocument).CurrentInputField != null)
|
||||||
@ -50,10 +86,16 @@ namespace DocumentManagement
|
|||||||
var element = (eventSender as XTextDocument).CurrentInputField;
|
var element = (eventSender as XTextDocument).CurrentInputField;
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
|
var etxt = element.Text;
|
||||||
|
|
||||||
element.Text = element.Text.Replace("\r", "").Replace("\n", "");
|
element.Text = element.Text.Replace("\r", "").Replace("\n", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompilerErrorCollection Errors { get { return cr.Errors; } }
|
public CompilerErrorCollection Errors { get { return cr.Errors; } }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user