clipboard

How to send to clipboard datagridview content like CTRL-C

前提是你 提交于 2019-12-11 01:59:23
问题 How to send to clipboard selected content from DataGridView, simulating CTRL-C behavior. This isn't working as expected: Clipboard.SetText(this.dataGridView1.SelectedCells.ToString()); User needs to paste in Excel. CTRL-C is working fine, but I need to script for context menu. 回答1: SelectedCells is a CellCollection and as such has no useful ToString method. If you want to copy just one cell you have to decide which and then copy its Value , e.g.: Clipboard.SetText(this.dataGridView1

Converting a pointer into a MemoryStream?

痴心易碎 提交于 2019-12-11 01:05:07
问题 I am trying to fetch a Device Independent Bitmap from the clipboard. I am well-aware that this can be done through the Clipboard.GetData function inbuilt in the .NET Framework, but since it is very buggy (as documented many places on the web), I want to use the APIs only. I have written the following code which works. //i can correctly cast this to a MemoryStream MemoryStream ms = Clipboard.GetData("DeviceIndependentBitmap") as MemoryStream; But I want to use it with the APIs, which just

Pipe from clipboard in linux subsytem for windows

爱⌒轻易说出口 提交于 2019-12-11 00:56:39
问题 Using the Linux Subsystem for Windows (LSW), clip.exe can be used to copy data to the windows clipboard: $ clip.exe /? CLIP Description: Redirects output of command line tools to the Windows clipboard. This text output can then be pasted into other programs. Parameter List: /? Displays this help message. Examples: DIR | CLIP Places a copy of the current directory listing into the Windows clipboard. CLIP < README.TXT Places a copy of the text from readme.txt on to the Windows clipboard. Is

Shoes problems: clipboard and scroll bar

我的未来我决定 提交于 2019-12-11 00:52:33
问题 The code below has (at least) two problems: the Copy button doesn't update the clipboard, and the edit_box doesn't show a vertical scroll bar when it should. Shoes.app (:title => "Test", :width => 1000, :height => 600) do background "#DFA" stack :margin => 30 do flow do button "Paste" do @sql.text = clipboard end button "Copy", :margin_left => 15 do clipboard = @sql.text alert(@sql.text.length.to_s + " characters copied to clipboard.") end end stack :margin_top => 10, :width => "100%",

Can't monitor system clipboard changes from a background java application on Mac OS X

我只是一个虾纸丫 提交于 2019-12-11 00:07:24
问题 I have a java program, that runs in the background and monitors the system clipboard for changes (i do this through polling, as it seems to be the only way besides the "ownership-variant", where i have to reset the content all the time to become the owner). If it discovers an input text in an specific format, it processes that text and overwrites the clipboard with the result (so i can copy the input and right after it paste the result while the program is running in background). This worked

Why is document.execCommand(“copy”) no longer working in Internet Explorer 11?

∥☆過路亽.° 提交于 2019-12-10 21:53:07
问题 In our application we are using the following logic to copy HTML (text and format) to the clipboard. function copy(element_id) { var aux = document.createElement("div"); aux.setAttribute("contentEditable", true); aux.innerHTML = document.getElementById(element_id).innerHTML; aux.setAttribute("onfocus", "document.execCommand('selectAll',false,null)"); document.body.appendChild(aux); aux.focus(); document.execCommand("copy"); document.body.removeChild(aux); console.log("COPY"); } <p id="demo">

Disconnected Context was detected c# clipboard

旧街凉风 提交于 2019-12-10 20:19:22
问题 Transition into COM context 0x27a7788 for this RuntimeCallableWrapper failed with the following error: Object is not connected to server (Exception from HRESULT: 0x800401FD (CO_E_OBJNOTCONNECTED)). This is typically because the COM context 0x27a7788 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else and cannot process the context transition. No proxy will be used to service the request on the COM component and calls will be made to the COM

Copying HTML to Word via VBA and clipboard loses special characters

无人久伴 提交于 2019-12-10 18:50:03
问题 I would like to paste some HTML-formated data to Word via VBA. HTML Data are obtained from MS XML by transforming xml document by given xsl into proper html and this transformed html data I want to put to Word preserving HTML formating. I found that only way to get HTML data to Word is to put them into clipboard. Im using this functions for that: http://support.microsoft.com/kb/274326 And then using PasteSpecial Im puting that to Word. In general it works but... The problem is with special

How can I enumerate the clipboard formats

时光总嘲笑我的痴心妄想 提交于 2019-12-10 17:55:01
问题 With WPF, I can get data in a given format from the clipboard: object test = Clipboard.GetGata (format); How can I enumerate the list of formats present in the clipboard? 回答1: List<String> dataFormats = typeof(DataFormats).GetFields(BindingFlags.Public | BindingFlags.Static) .Select(f => f.Name) .ToList(); this should give you all the Fields from DataFormats List<String> dataFormatsInClipboard = dataFormats.Where( df => Clipboard.ContainsData(df) ) .ToList(); will give you just the ones that

Paste Files from Clipboard with Cut or Copy

牧云@^-^@ 提交于 2019-12-10 15:48:13
问题 The .NET Clipboard class has methods to put files into the clipboard and also define if they should be moved or copied (cut/copy). But if I want to paste files that were copied into the clipboard, I see no way to find out if the file was cut or copied with standard Clipboard methods. 回答1: The information is stored in a Clipboard data object named "Preferred DropEffect". A memory stream containing a 4-byte-array contains the enum value for System.Windows.DragDropEffects in the first byte: