Exemplo n.º 1
0
        /*
         * Clipboard -- Copy and Paste
         */

        private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataObject dataObject;

            // make certain that a valid link is in the German fields
            if (string.IsNullOrEmpty(txtDeURL.Text))
            {
                return;
            }

            // generate a clipboard envelope
            string linkHtml = BuildLinkTag(txtDeText.Text, txtDeURL.Text);
            string env      = ClipboardEnvelope.BuildHtmlClipboardEnvelope(linkHtml);

            dataObject = new DataObject();
            dataObject.SetData("HTML Format", env);

            // put the data on the clipbaord
            Clipboard.SetDataObject(dataObject);
        }
Exemplo n.º 2
0
        private void MainDlg_MouseDown(object sender, MouseEventArgs e)
        {
            DataObject dataObject;

            // make certain that a valid link is in the German fields
            if (string.IsNullOrEmpty(txtDeURL.Text))
            {
                return;
            }

            string linkHtml = BuildLinkTag(txtDeText.Text, txtDeURL.Text);
            string env      = ClipboardEnvelope.BuildHtmlClipboardEnvelope(linkHtml);

            dataObject = new DataObject();
            dataObject.SetData("HTML Format", env);

            // start a Drag&Drop process
            _emitingDragDrop = true;
            DragDropEffects effs = txtDeURL.DoDragDrop(dataObject, DragDropEffects.Copy);

            _emitingDragDrop = false;
        }