Be.Windows.Forms.HexBox.CopyHex C# (CSharp) Метод

CopyHex() публичный Метод

Copies the current selection in the hex box to the Clipboard in hex format.
public CopyHex ( ) : void
Результат void
        public void CopyHex()
        {
            if (!CanCopy()) return;

            // put bytes into buffer
            byte[] buffer = GetCopyData();

            DataObject da = new DataObject();

            // set string buffer clipbard data
            string hexString = ConvertBytesToHex(buffer); ;
            da.SetData(typeof(string), hexString);

            //set memorystream (BinaryData) clipboard data
            System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer, 0, buffer.Length, false, true);
            da.SetData("BinaryData", ms);

            Clipboard.SetDataObject(da, true);
            UpdateCaret();
            ScrollByteIntoView();
            Invalidate();

            OnCopiedHex(EventArgs.Empty);
        }

Usage Example

Пример #1
0
 private void menuCopyHex_Click(object sender, EventArgs e)
 {
     hexBox1.CopyHex();
 }
HexBox