Drag and drop image into 2d Picture

Hi All,
I'm trying to implement a bit of "MS paint" magic for a customer's dialog. I want to be able to drag and drop into a 2d picture control. Ideally, I'd like to be able to move this around and resize it once it's there, but let's start with the first part - how to drag and drop from e.g. the desktop onto the 2d picture control. The rest is nice-to-have but unnecessary. 
I've seen a clever example on here using a transparent path control, but that's not going to cut it here (I have other events linked with that picture box, e.g. right now I have a double-click event adding text to the image). 
Thanks for any ideas... I've looked briefly into using the windows API (i.e. constructor nodes) but, there be dragons. 
Solved!
Go to Solution.

pobrepablo1 wrote:
Hi All,
I'm trying to implement a bit of "MS paint" magic for a customer's dialog. I want to be able to drag and drop into a 2d picture control. Ideally, I'd like to be able to move this around and resize it once it's there, but let's start with the first part - how to drag and drop from e.g. the desktop onto the 2d picture control. The rest is nice-to-have but unnecessary. 
I've seen a clever example on here using a transparent path control, but that's not going to cut it here (I have other events linked with that picture box, e.g. right now I have a double-click event adding text to the image). 
Thanks for any ideas... I've looked briefly into using the windows API (i.e. constructor nodes) but, there be dragons. 
Well, it is possible and I got it working . Let me clean it up, close my references, etc and I will post it. You will have to use the .net control though so hopefully that is ok. You could manage it for the labVIEW picture control with a mix of .net or winAPI to handle the drag and drop and see if it's over your picture control and then somehow get the path of the drag and load the path into the LabVIEW picture control. But, you may just want to stick with it all using the .net control
CLA, LabVIEW Versions 2010-2013

Similar Messages

  • Drag and drop images into anchored frames -- can this be done with the images imported by reference?

    My company bought a product from another company and the only manuals files that came with it were in pdf format. I am currently grabbing text out in Acrobat, then pasting and reformatting it in FrameMaker. Boring and tedious. . . .
    Eventually I get to the point of importing the illustrations. There are *hundreds* of them. As a rule, we import the files by reference, to keep the chapter size smaller and to be able to double click the image to open it for modification.
    However, I can drag an image file from the folder window and drop it into an anchored frame. Oooh, this is fast--way faster than all the mousework that goes into clicking file>import>file>[choosing the file then hitting the import button].
    But, dang it, that copies the image into the FrameMaker file. No double-click opening. Giant fm. file size. Mad boss, shaking an SOP standards sheet in my face.
    So, my question: Is there a way to import an image *by reference* by dragging and dropping them into an anchored frame?
    Thanks, folks.
    Moore. Matt Moore.

    I tried the RTF route and, in addition to getting the body text I wanted, got paragraph after paragraph of the page numbers, the illustration text, the header and footer verbiage, all randomly placed between body text paragraphs.
    I did the same file twice, once by saving as RTF and deleting unwanted stuff, then repairing body paragraphs (each line of which is a seperate paragraph in the RTF file) and also by sweeping only the necessary text, then copying and pasting it page by page. The second method was a bit faster and less frustrating. Not to say that it isn't slow and frustrating in itself, but just a bit less. Less errors, too, with the second method.
    Bummer about importing by reference. I don't suppose there's a way to set up recorded actions with hotkeys, is there? Like in Illustrator?
    Thanks, Art.
    Moore. Matt Moore.

  • Can`t drag and drop images into PSE5

    hi,
    i`m from germany, so sorry for my english..
    i use pse5 since a few years and a few month with windows7..today i had to reinstall it and now i can`t drag and drop images from explorer or acdsee to PSE workspace. i get no error-message , only this circle with a diagonal line..
    i CAN drag and drop images from the editor..
    - i reinstalled it and repaired it
    - tried diffferent compatability modes
    - i don`t run the program as a administrator ( tried it- it was the same)
    so can anyone please help me?
    thank you so much!
    mareen

    Try making a direct shortcut to the Organizer and then the Editor.
    You should then be able to drag and drop on to the desktop icon.
    On Windows right click on the desktop and select New >> Shortcut
    Browse to Computer OS C:
    And find the PSE Organizer application in Program Files or Program Files (x86) on Windows 7 - 64 bit.
    Inside the Adobe >> Photoshop Elements Organizer (yellow folder) you are looking for an application file “PhotoshopEementsOrganizer” with six small icons (e.g. representing thumbnails - could be different in PSE5 but look for the exe file)
    Select it and click OK
    Click next
    Rename by taking out Photoshop Elements leaving just the word Organizer
    Then click finish
    You should now be able to launch directly form the desktop by double clicking on the icon.
    You can set up a similar direct link to the Editor application.
     

  • Drag and drop Images into Multiple Targets

    Hello,
    I want to alter the NI example "Drag and Drop - Multiple Data Types to Start Drag" to use multiple image Targets.  The current VI only allows for dropping image into a single Target.  I want to duplicate the target window a few times, in order to drop different images into each different Target.  I can't seem to figure out how the VI recognizes and differentiates the Targets. 
    Thanks,
    Labview 2009 SP1

    Hello,
    Please see attached... That's a simple way to perform what you need : each target is handled in the same event case (the target is differentiated by using control refnum).
    Hope this helps,
    J.
    Attachments:
    Screenshot.jpg ‏132 KB

  • Drag and Drop Image into JTable

    I was wondering if anyone can tell me if it is possible to have an image dragged and dropped into a JTable where the single image snaps to multiple columns and rows?
    Thank you.

    Can anyone point me in the right direction for doing the following:
    Drag and drop an image into a JTable where the single image snaps to multiple columns and rows.
    Thanks.

  • My pages has stopped letting me drag and drop images

    my pages has stopped letting me drag and drop images, into the template

    Just the one template or all templates?
    Can you drag and drop an image anywhere on the page?
    When you have a problem try and isolate it.
    Not all images are placeholders.
    Also if you get oddball things happening sometimes a simple restart of your computer will fix them.
    Peter

  • Why can't I drag and drop images from the browser into other programs?

    Ever since I upgraded to Firefox 4 (even after I upgraded again to Firefox 5) I have been unable to drag images from the browser into other programs, including MS Paint and IcoFx. I receive an error message stating that the file (the address given lists it as being located in the temporary files folder) cannot be found.
    Prior to this I had always been able to conveniently drag and drop images for easy editing without having to save first and then open them. This feature is important to me, as I work with graphics very often, and is still available in Chrome and Internet Explorer. I love Firefox though, and hope that there is something I can do to fix the problem.

    I had this problem on Windows 8.1.1 and iTunes 11.2.2.3
    To resolve it from within Itunes I did :  Edit, Preferences, Sharing.
    I took the tick out of "Share my library on my local network"
    Click OK.
    Closed iTunes/
    Reopened iTunes and I can drag and drop.
    I went back into Edit, Preferences, Sharing and put the tick back and clicked OK.
    Works fine now.

  • Drag and drop file into email gets me an icon, not the image. Is there a simple fix?

    I am used to drag and drop image import into apple email. Recently I get a "mail attachment" icon for images that have been previously sent in other email. I would like to see the actual image in every email if possible. How can that happen?

    Thanks for the help. Dragging the thumbnail onto the album tab works great. Too bad this was not a bit clearer in the previous posts.

  • How to change this code to drag and drop image/icon into it??

    Dear Friends:
    I have following code is for drag/drop label, But I need to change to drag and drop image/icon into it.
    [1]. code 1:
    package swing.dnd;
    import java.awt.*;
    import javax.swing.*;
    public class TestDragComponent extends JFrame {
         public TestDragComponent() {
              super("Test");
              Container c = getContentPane();
              c.setLayout(new GridLayout(1,2));
              c.add(new MoveableComponentsContainer());
              c.add(new MoveableComponentsContainer());
              pack();
              setVisible(true);
         public static void main(String[] args) {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch (Exception ex) {
                   System.out.println(ex);
              new TestDragComponent();
    }[2]. Code 2:
    package swing.dnd;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.awt.dnd.*;
    import java.awt.datatransfer.*;
    import java.awt.image.*;
    import java.awt.dnd.DragSource;
    import java.awt.dnd.DropTarget;
    public class MoveableComponentsContainer extends JPanel {     
         public DragSource dragSource;
         public DropTarget dropTarget;
         private static BufferedImage buffImage = null; //buff image
         private static Point cursorPoint = new Point();
         public MoveableComponentsContainer() {
              setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.white, Color.gray));
              setLayout(null);
              dragSource = new DragSource();
              ComponentDragSourceListener tdsl = new ComponentDragSourceListener();
              dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, new ComponentDragGestureListener(tdsl));
              ComponentDropTargetListener tdtl = new ComponentDropTargetListener();
              dropTarget = new DropTarget(this, DnDConstants.ACTION_MOVE, tdtl);
              setPreferredSize(new Dimension(400,400));
              addMoveableComponents();
         private void addMoveableComponents() {
              MoveableLabel lab = new MoveableLabel("label 1");
              add(lab);
              lab.setLocation(10,10);
              lab = new MoveableLabel("label 2");
              add(lab);
              lab.setLocation(40,40);
              lab = new MoveableLabel("label 3");
              add(lab);
              lab.setLocation(70,70);
              lab = new MoveableLabel("label 4");
              add(lab);
              lab.setLocation(100,100);
         final class ComponentDragSourceListener implements DragSourceListener {
              public void dragDropEnd(DragSourceDropEvent dsde) {
              public void dragEnter(DragSourceDragEvent dsde)  {
                   int action = dsde.getDropAction();
                   if (action == DnDConstants.ACTION_MOVE) {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
                   else {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
              public void dragOver(DragSourceDragEvent dsde) {
                   int action = dsde.getDropAction();
                   if (action == DnDConstants.ACTION_MOVE) {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
                   else {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
              public void dropActionChanged(DragSourceDragEvent dsde)  {
                   int action = dsde.getDropAction();
                   if (action == DnDConstants.ACTION_MOVE) {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
                   else {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
              public void dragExit(DragSourceEvent dse) {
                 dse.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
         final class ComponentDragGestureListener implements DragGestureListener {
              ComponentDragSourceListener tdsl;
              public ComponentDragGestureListener(ComponentDragSourceListener tdsl) {
                   this.tdsl = tdsl;
              public void dragGestureRecognized(DragGestureEvent dge) {
                   Component comp = getComponentAt(dge.getDragOrigin());
                   if (comp != null && comp != MoveableComponentsContainer.this) {
                        cursorPoint.setLocation(SwingUtilities.convertPoint(MoveableComponentsContainer.this, dge.getDragOrigin(), comp));
                        buffImage = new BufferedImage(comp.getWidth(), comp.getHeight(), java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE);//buffered image reference passing the label's ht and width
                        Graphics2D graphics = buffImage.createGraphics();//creating the graphics for buffered image
                        graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));     //Sets the Composite for the Graphics2D context
                        boolean opacity = ((JComponent)comp).isOpaque();
                        if (opacity) {
                             ((JComponent)comp).setOpaque(false);                         
                        comp.paint(graphics); //painting the graphics to label
                        if (opacity) {
                             ((JComponent)comp).setOpaque(true);                         
                        graphics.dispose();
                        remove(comp);
                        dragSource.startDrag(dge, DragSource.DefaultMoveDrop , buffImage, cursorPoint, new TransferableComponent(comp), tdsl);     
                        revalidate();
                        repaint();
         final class ComponentDropTargetListener implements DropTargetListener {
              private Rectangle rect2D = new Rectangle();
              Insets insets;
              public void dragEnter(DropTargetDragEvent dtde) {
                   Point pt = dtde.getLocation();
                   paintImmediately(rect2D.getBounds());
                   rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
                   ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
                   dtde.acceptDrag(dtde.getDropAction());
              public void dragExit(DropTargetEvent dte) {
                   paintImmediately(rect2D.getBounds());
              public void dragOver(DropTargetDragEvent dtde) {
                   Point pt = dtde.getLocation();
                   paintImmediately(rect2D.getBounds());
                   rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
                   ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
                   dtde.acceptDrag(dtde.getDropAction());
              public void dropActionChanged(DropTargetDragEvent dtde) {
                   Point pt = dtde.getLocation();
                   paintImmediately(rect2D.getBounds());
                   rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
                   ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
                   dtde.acceptDrag(dtde.getDropAction());
              public void drop(DropTargetDropEvent dtde) {
                   try {
                        paintImmediately(rect2D.getBounds());
                        int action = dtde.getDropAction();
                        Transferable transferable = dtde.getTransferable();
                        if (transferable.isDataFlavorSupported(TransferableComponent.COMPONENT_FLAVOR)) {
                             Component comp = (Component) transferable.getTransferData(TransferableComponent.COMPONENT_FLAVOR);
                             Point location = dtde.getLocation();
                             if (comp == null) {
                                  dtde.rejectDrop();
                                  dtde.dropComplete(false);
                                  revalidate();
                                  repaint();
                                  return;                              
                             else {                         
                                  add(comp, 0);
                                  comp.setLocation((int)(location.getX()-cursorPoint.getX()),(int)(location.getY()-cursorPoint.getY()));
                                  dtde.dropComplete(true);
                                  revalidate();
                                  repaint();
                                  return;
                        else {
                             dtde.rejectDrop();
                             dtde.dropComplete(false);
                             return;               
                   catch (Exception e) {     
                        System.out.println(e);
                        dtde.rejectDrop();
                        dtde.dropComplete(false);
    }Thanks so much for any help.
    Reagrds
    sunny

    Well, I don't really understand the DnD interface so maybe my chess board example will be easier to understand and modify:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=518707
    Basically what you would need to do is:
    a) on a mousePressed you would need to create a new JLabel with the icon from the clicked label and add the label to the glass pane
    b) mouseDragged code would be the same you just repaint the label as it is moved
    c) on a mouseReleased, you would need to check that the label is now positioned over your "drop panel" and then add the label to the panel using the panels coordinates not the glass pane coordinates.

  • With new Photos app, I can no longer drag and drop photos into other applications as I did in the past with iPhoto.

    With the new Photos app, I can no longer drag and drop photos into other applications as I did with iPhoto.  For instance, I have a photo collage app that in the past, I could just drag in the photos I wanted to include.  Now, I can DRAG the photos, but they do not DROP.  So, I have to go through the export process.  It is tedious.  What am I missing?  Where can I turn on the drag and drop feature for Photos?

    YOu're not looking in the right palce. That's inside the iPhoto Application.
    You need to look inside the iPhoto Library
    As I sid above:
    Go to your Pictures Folder and find the iPhoto Library there
    Regards
    TD

  • How do I create a text style in CC libraries? Every time I drag and drop text into library form Photoshop or illustrator it turns it into a graphic.

    How do I create a text style in CC libraries? Every time I drag and drop text into library form Photoshop or illustrator it turns it into a graphic.
    If I select the text layer and click the text style button in the library it just creates a new text style for Myriad Pro 12pt - I'm not using that anywhere in my document.
    Can anyone help? Seems like a bug to me as I'm trying what the video tutorials are saying.
    Thanks

    I realize AI is an illustration program.
    Do you realize it is an object-based vector-based program? Do you know the difference between raster-based and vector-based content?
    My question seems to be all over the forum but no one has been able to answer other than exporting to these file formats, which make text look awful and of no use....
    And yet everyone else in the world makes proper web images every day using a plethora of programs, including these...go figure.
    Am I missing something?
    Yep. Pretty much.
    Hello Adobe! People use transparency on website logos.
    Hello, cocteau! What you're calling "transparency" is inherent to object-based vector artwork. But web browsers don't support object-based vector artwork, except via file formats like Flash and SVG, or by viewing as a PDF in a plug-in version of Reader. Raster imaging in general only supports "transparency" by either indexing a specific color (i.e.; "don't display this color", as in GIF) or including an alpha channel (i.e.; "blend all the pixels with existing pixels, based on values from this extra channel", as in PNG). It's all in the raster file format you use, cocteau; it has little-to-nothing to do specifically with Adobe software. Such things are among the most basic matters understood by someone doing web design.
    When I export an eps from .ai file, and open the eps in photoshop,...I save as a gif for the web, it goes back to the original problem...creates jagged text. I"m giving up on this garbage...Thanks a lot adobe! Lower the price of this software if this is all that can be done.
    Once it leaves Photoshop (or Illustrator, or whatever) as a non-proprietary raster image format, it's all about what the format can do re "transparency". You can do this stuff with most any graphics program. You should read about basic web design and the differences between raster and vector content, rather than rant.
    JET

  • How come I cant drag and drop images onto my imove

    I can't drag and drop images from my desktop or folder into imovie.

    Simply because you are not posting to the iMovie forum. Post there and find out.

  • Drag and drop images from the OS or select images over filebrowser

    Hello,
    I want to create an image upload tool in JavaFX with similar functionality like Jumploader (http://jumploader.com/). The users should be able to select images from the filesystem that will be resized and uploaded to their website, similar as in Facebook. The difference is that I want users to be able to crop images directly in my application. This is something, other upload tools do not offer.
    I was searching weeks on the web trying to find a sample on how to drag and drop images in to a JavaFX 1.3.1 app or also to create a file browser. I have found many examples but they seem to be outdated. Is it to early yet to try and start projects like these with JavaFX as JavaFX is still under development? Or can anybody lead me in to the right direction?
    Thanks,
    Chris

    To be more precise, you can setup a JComponent or JPanel on top of your JavaFX nodes that has a TransferHandler that can convert the (AWT/Swing) images dragged to the app to JavaFX image and then insert it into the underlying node.
    As for the file chooser itselft: ListView and the JavaFX composer can allow you to create one quite easily. TreeView can aslso be used to a lesser extend (still a big buggy). For both of these, there are small bugs in the Cell API that may (or may not) prevent from displaying a proper thumbnail in the cells.
    You can also use a regular JFileChooser if you do not mind the dialog box having a different LnF from the rest of your application.

  • How come in Pages, i cannot drag and drop images?

    how come in Pages, i cannot drag and drop images?

    Yes you can in all versions.
    It helps if you actually describe what you are doing.
    Where are you dragging it from and where are you dragging it to?
    In what version of Pages?
    I suspect you are trying to drag an image into a Table, Header or Footer in Pages 5, which is no longer possible. Feature removed by Apple.
    Peter

  • Error message when dragging and dropping images to album

    I recently installed the Elements 12 upgrade on my MacBook Pro. My previous version was Elements 10. When I try to add new images to my existing albums by selecting, dragging and dropping them into an album the operation does not work and i get an error message "Error Applying Keyword Tag(s)"

    Thanks for your reply Andaleeb,
    When you look at the numerous discussions on the PSE forum on this Organizer window issue it's not just a problem I had (Thread 14444851) but other users who have Elements 10, 11 and 12 are experiencing similar problems. There appears to be a serious compatibility problem with OSX 10.9.2 and these versions of PSE. Although my issue was fixed by your support staff,  the fact that many other users are experiencing this issue points to the need for a universal fix applicable to all Mac users. There is a lot of frustration out there among Mac users and Adobe needs to deal with this problem.
    I am really surprised that on all the other discussion posts on this issue, there is not a single comment or response from Adobe staff! Given the lack of response from Adobe, it appears that the Adobe policy is to sit back and let the Mac users determine their own solutions.
    Please pass this post on to your management so that corrective action can be initiated.
    Thanks for your help.

Maybe you are looking for

  • How do I get Favourites to appear on my page?

    Using Mozilla for the first time and going to Hotmail, I have Bookmarks, whatever that is, but no access to My Favorites. That is what I need otherwise it is useless

  • How to solve repeated Bugcheck. The bugcheck was: 0x000000d1 (0x0000000000000010, 0x0000000000000002, 0x0000000000000000, 0xfffff8016a71d56c).

    Log Name:      System Source:        Microsoft-Windows-WER-SystemErrorReporting Date:          6/25/2014 08:09:27 Event ID:      1001 Task Category: None Level:         Error Keywords:      Classic User:          N/A Description: The computer has reb

  • Crash Report MAC OS X 10.11 Beta

    Model Identifier: MacBookAir6,2 (Macbook Air 13")System Version: OS X 10.11 (15A178w)Kernel Version: Darwin 15.0.0Processor Name: Intel Core i5Processor Speed: 1.4 GHzNumber of Processors: 1Total Number of Cores: 2L2 Cache (per Core): 256 KBL3 Cache:

  • Need HELP solving a report writing solution

    I have a pre-existing report, that contains a sub-report.  In the sub report, How do I get the report to print "something" when the field it is pulling from is empty? In other words....I am trying to pull information in the sub report based on a work

  • Where to get struts book for free download

    i have tried with the http://www.theserverside.com/tss i not able to login i have register the correctly User: [email protected] is registered, but could not be logged on because: This email address is not validated. Wait for the validation email. do