private void OnSetRasterButtonClick(NEventArgs args)
        {
            // get a raster to place on the clipbar
            NRaster raster = null;

            switch ((int)args.TargetNode.Tag)
            {
            case 0:
                raster = NResources.Image__48x48_Book_png.ImageSource.CreateRaster();
                break;

            case 1:
                raster = NResources.Image__48x48_Clock_png.ImageSource.CreateRaster();
                break;

            case 2:
                raster = NResources.Image__48x48_Darts_png.ImageSource.CreateRaster();
                break;
            }

            // create a data object
            NDataObject dataObject = new NDataObject();

            dataObject.SetData(NDataFormat.RasterFormat, raster);

            // set it on the clipboard
            NClipboard.SetDataObject(dataObject);
        }
Exemple #2
0
        private void OnCopyLinkToClipboardClick(NEventArgs arg)
        {
            NDataObject dataObject = new NDataObject();
            NXmlElement element    = (NXmlElement)arg.CurrentTargetNode.Tag;

            dataObject.SetData(NDataFormat.TextFormat, m_ExamplesPath + "?example=" + element.GetAttributeValue("type"));
            NClipboard.SetDataObject(dataObject);
        }
        private void OnSetTextButtonClick(NEventArgs args)
        {
            NDataObject dataObject = new NDataObject();

            dataObject.SetData(NDataFormat.TextFormat, m_TextBox.Text);
            NClipboard.SetDataObject(dataObject);

            m_TextBox.Text = "Text box content moved to clipboard.";
        }
        private void OnSetRTFButtonClick(NEventArgs args)
        {
            NDataObject dataObject = new NDataObject();

            using (MemoryStream stream = new MemoryStream())
            {
                m_RichText.SaveToStream(stream, new NRtfTextFormat());
                dataObject.SetData(NDataFormat.RTFFormat, stream.ToArray());
                NClipboard.SetDataObject(dataObject);
            }

            // Clear the rich text
            m_RichText.Content.Sections.Clear();

            NSection section = new NSection();

            m_RichText.Content.Sections.Add(section);
            section.Blocks.Add(new NParagraph("Rich text content moved to clipboard."));
        }