2023년 10월 19일 목요일

C# PictureBox에서 마우스 우클릭으로 clipboard에 복사하기 기능 추가

 

  1.  
  2. private void PICVIEW_MouseClick(object sender, MouseEventArgs e)
  3. {
  4. if (e.Button == MouseButtons.Right)
  5. {
  6. ContextMenu ctxM = new ContextMenu();
  7. Point mousePoint = new Point(e.X, e.Y);
  8. MenuItem m1 = new MenuItem();
  9. m1.Text = "Copy Image";
  10. ctxM.MenuItems.Add(m1);
  11. ctxM.Show(PICVIEW, mousePoint);
  12. m1.Click += (senders, es) =>
  13. {
  14. Clipboard.SetImage(m_PicViewImage); //m_PicViewImage ==> One of image file
  15. };
  16. }
  17. }
  18.  

댓글 없음:

댓글 쓰기