示例#1
0
        protected override void WndProc(ref Message m)
        {
            // Defined in winuser.h
            const int WM_DRAWCLIPBOARD = 0x308;
            const int WM_CHANGECBCHAIN = 0x030D;

            switch (m.Msg)
            {
            case WM_DRAWCLIPBOARD:
                // The clipboard contents have been changed.
                if (this.ClipboardChanged != null)
                {
                    this.ClipboardChanged(this, new EventArgs());
                }
                ClipboardControl.SendMessage(this.m_NextClipboardViewer, m.Msg, m.WParam, m.LParam);
                break;

            case WM_CHANGECBCHAIN:
                // Another clipboard viewer has been registered in
                // the chain.
                if (m.WParam == this.m_NextClipboardViewer)
                {
                    this.m_NextClipboardViewer = m.LParam;
                }
                else
                {
                    ClipboardControl.SendMessage(this.m_NextClipboardViewer, m.Msg, m.WParam, m.LParam);
                }
                break;

            default:
                base.WndProc(ref m);
                break;
            }
        }
示例#2
0
 public WindowsClipboard()
 {
     WindowsClipboard.m_Control = new ClipboardControl();
     if (Central.Manager.IDE == null || (Central.Manager.IDE as WindowsIDE).Visible == false)
         Central.Manager.IDEOpened += new EventHandler((_a, _b) => { this.Register(); });
     else
         this.Register();
 }
示例#3
0
        protected override void Dispose(bool disposing)
        {
            Action a = () => { ClipboardControl.ChangeClipboardChain(this.Handle, this.m_NextClipboardViewer); };

            if (this.InvokeRequired)
            {
                this.Invoke(a);
            }
            else
            {
                a();
            }
        }
示例#4
0
 /// <summary>
 /// Creates a new clipboard control; this must be added to a form
 /// in order to receive clipboard events.
 /// </summary>
 public ClipboardControl()
 {
     this.m_NextClipboardViewer = ClipboardControl.SetClipboardViewer(this.Handle);
 }
示例#5
0
 private void Register()
 {
     WindowsClipboard.m_Control = new ClipboardControl();
     WindowsClipboard.m_Control.ClipboardChanged += new EventHandler((sender, e) =>
     {
         if (this.ContentsChanged != null)
             this.ContentsChanged(null, new EventArgs());
     });
     (Central.Manager.IDE as WindowsIDE).Controls.Add(WindowsClipboard.m_Control);
 }