望各位大虾帮忙解决一下!!谢谢了!

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Text.RegularExpressions;namespace Take_Out_Messy_Code
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void buttonBegin_Click(object sender, EventArgs e)
            {
                //取得剪貼簿內容
                IDataObject dataObject = Clipboard.GetDataObject();
                if (dataObject.GetDataPresent(DataFormats.Rtf))
                {
                    //取出RTF格式
                    string rtf = dataObject.GetData(DataFormats.Rtf) as string;
                    //以Regex.Replace去除多餘字元(註: 不管是否有問題,一律強制處理)
                    string fixedRtf =
                      Regex.Replace(rtf, @”\\uinput2(?<uc>\\u-?\d*)\s..”,
                    (m) =>
                    {
                        return m.Groups["uc"].Value + “?”;
                    });
                    //另建新DataObject物件
                    DataObject newDataObject = new DataObject();
                    //RTF格式用修正後的字串,其餘依原值
                    foreach (String t in dataObject.GetFormats())
                        newDataObject.SetData(t,
                        t == “Rich Text Format” ? fixedRtf :
                        dataObject.GetData(t));
                    //將修正後內容寫入剪貼簿
                    Clipboard.SetDataObject(newDataObject, true);
                    MessageBox.Show(“Take Out Pessy Code successful!”);
                }
            }
        }
    }
    这是解决问题的源代码,鄙人在其他网站上找的!编译生成程序,每次复制后运行程序即可(即修改一下剪切板)!
      

  2.   

    VS2010的SP1已经修复了此功能,大家可以升级一下!
      

  3.   

    我这还有一个别人编好的小程序(几KB),主要代码也就是上面内容,大家想要的话可以找我,我的QQ1483221059