用剪贴板选择句子的一部分而不是整个句子

我想要我的程序,而不是选择返回的整个句子,如果复制了那个句子的一部分也是可能的。

这是我的代码:

protected override void WndProc(ref Message m) { base.WndProc(ref m); //check if current operation is a clipboard if (m.Msg == WM_DRAWCLIPBOARD) { //then we use a try catch block so if //anything wrong happens in Clipboard.GetText() our program wont crash try { //with foreach we go through all our questions foreach (string question in questionList) { //and we check if clapboarded text is matches with our question if (Clipboard.GetText() == "When a computer is being assembled, which action can be taken to help eliminate cable clutter within a computer case?") { notifyIcon1.Icon = SystemIcons.Exclamation; notifyIcon1.BalloonTipTitle = "When a computer is being assembled, which action can be taken to help eliminate cable clutter within a computer case?"; notifyIcon1.BalloonTipText = "Install a modular power supply.*"; notifyIcon2.BalloonTipIcon = ToolTipIcon.Error; notifyIcon1.ShowBalloonTip(100); return; } 

这是一个问题:“当计算机正在组装时,可以采取哪些措施来帮助消除计算机机箱内的线缆杂乱?”

我希望你举例如果你复制了这个:当一台计算机正在组装时

您获得相同的匹配和相同的通知

提前致谢

使用字符串方法.Contains()而不是相等比较。

 if (Clipboard.GetText().Contains(yourString))