コード例 #1
0
 private void btPaste_Click(object sender, EventArgs e)
 {
     if (Clipboard.ContainsData("MathNode"))
     {
         object data = Clipboard.GetData("MathNode");
         if (data != null)
         {
             string      s   = data.ToString();
             XmlDocument doc = new XmlDocument();
             doc.LoadXml(s);
             if (doc.DocumentElement != null)
             {
                 try
                 {
                     Type     t    = XmlUtil.GetLibTypeAttribute(doc.DocumentElement);
                     MathNode node = mathExpCtrl1.AddMathNode(t);
                     node.Load(doc.DocumentElement);
                     mathExpCtrl1.RefreshVariableMap();
                     mathExpCtrl1.Refresh();
                     mathExpCtrl1.Focus();
                 }
                 catch (Exception err)
                 {
                     MessageBox.Show(err.Message);
                 }
             }
         }
     }
 }