コード例 #1
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     if (e.KeyData == (Keys.Control | Keys.C))
     {
         QTUtility2.SetStringClipboard(Text + Environment.NewLine + Environment.NewLine + labelMessage.Text);
     }
 }
コード例 #2
0
        private void CopyFileNames(bool fPath)
        {
            List <string>          lstPaths = new List <string>();
            DropDownMenuDropTarget root     = GetRoot(this);

            if (root != null)
            {
                GetCheckedItem(root, lstPaths, false, true);
            }
            if (lstPaths.Count == 0)
            {
                foreach (ToolStripItem item in DisplayedItems)
                {
                    if (!item.Selected)
                    {
                        continue;
                    }
                    QMenuItem item2 = item as QMenuItem;
                    if ((item2 != null) && !string.IsNullOrEmpty(item2.Path))
                    {
                        string path = item2.Path;
                        if (!fPath)
                        {
                            try {
                                path = System.IO.Path.GetFileName(path);
                            }
                            catch {
                            }
                        }
                        if (!string.IsNullOrEmpty(path))
                        {
                            QTUtility2.SetStringClipboard(path);
                            fContainsFileDropList    = false;
                            itemKeyInsertionMarkPrev = null;
                            Invalidate();
                        }
                    }
                    break;
                }
            }
            else
            {
                string str = string.Empty;
                foreach (string str3 in lstPaths)
                {
                    if (fPath)
                    {
                        str = str + str3 + Environment.NewLine;
                    }
                    else
                    {
                        try {
                            str = str + System.IO.Path.GetFileName(str3) + Environment.NewLine;
                            continue;
                        }
                        catch {
                            continue;
                        }
                    }
                }
                if (str.Length > 0)
                {
                    QTUtility2.SetStringClipboard(str);
                    fContainsFileDropList    = false;
                    itemKeyInsertionMarkPrev = null;
                    Invalidate();
                }
            }
        }