CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Posts
    29

    Dropping Images to a Picture Control

    Does anyone know how to be able to drop an image from the clipboard onto an image control?

    I would like to be able to allow someone to do press "print scrn" and have the image in the clipboard like usual, but then have a control on the form where they could Past it by either "shift Insert" (or Ctrl X or what the other option is) or by some other method to paste the clipboard image to the control.

    Does anyone know if this is easily available?

    Thank you very much

    David Stephen



  2. #2
    Join Date
    Nov 1999
    Posts
    14

    Re: Dropping Images to a Picture Control

    Piece of cake


    private Sub Form_KeyPress(KeyAscii as Integer)

    If KeyAscii = 22 then 'Ctrl+V was pressed
    If Clipboard.GetFormat(vbCFBitmap) then 'Make sure a bitmap is in the clipboard
    Image1.Picture = Clipboard.GetData(vbCFDIB) 'Load the picture on to the image control
    End If
    End If

    End Sub

    private Sub Form_Load()
    me.KeyPreview = true 'allow the form to view all key press events
    Image1.Stretch = true 'I want the iamge to size into the image control
    End Sub





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured