private void RemoveBtn_Click(object sender, EventArgs e) { // set focus back to the local clipboard LocalClipboard.Focus(); // remove the current index of the local clipboard LocalClipboard.Remove(); }
protected override void WndProc(ref Message m) { //const int WM_NCPAINT = 0x0085; // message sent to a window when its frame must be painted const int WM_DRAWCLIPBOARD = 0x0308; // clipboard changed event const int WM_CHANGECBCHAIN = 0x030D; // change clipboard chain event const int WM_HOTKEY = 0x0312; // hotkey pressed event switch (m.Msg) { //case WM_NCPAINT: // // get MultiPaste's device context, which permits painting anywhere in the window // IntPtr hDC = GetWindowDC(this.Handle); // if ((int)hDC != 0) // { // Graphics graphics = Graphics.FromHdc(hDC); // Rectangle rectangle = new Rectangle(0, 0, 4800, 23); // graphics.FillRectangle(Brushes.Red, rectangle); // graphics.Flush(); // ReleaseDC(this.Handle, hDC); // } // break; case WM_DRAWCLIPBOARD: // handle clipboard change if bool is true if (LocalClipboard.HandleClipboard) { mainWindow.OnClipboardChange(); } // send message to the next clipboard viewer SendMessage(clipboardViewerNext, m.Msg, m.WParam, m.LParam); break; case WM_CHANGECBCHAIN: // handle a change in the clipboard chain if (m.WParam == clipboardViewerNext) { clipboardViewerNext = m.LParam; } else { SendMessage(clipboardViewerNext, m.Msg, m.WParam, m.LParam); } break; case WM_HOTKEY: if (m.WParam.ToInt32() == DISP_ID) { switch (mainWindow.WindowState) { case FormWindowState.Minimized: mainWindow.WindowState = FormWindowState.Normal; break; case FormWindowState.Normal: // if MultiPaste is the foreground window, minimize to the system tray if (GetForegroundWindow() == mainWindow.Handle) { mainWindow.Visible = false; } // else bring MultiPaste to the foreground else { SetForegroundWindow(mainWindow.Handle); if (!mainWindow.Visible) { mainWindow.Visible = true; LocalClipboard.Focus(); } } break; case FormWindowState.Maximized: mainWindow.WindowState = FormWindowState.Minimized; break; } } break; } // continue the WndProc chain base.WndProc(ref m); }