in

Archived Data Techniques Forums

how to get selected Thumbnail viewer control item or item index

Last post 01-21-2010 2:47 PM by brianb. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-21-2010 2:47 AM

    how to get selected Thumbnail viewer control item or item index

    Hi All,

    Thank you for Advance. 

    We are using ImageMan Viewer and Thumbnail viewer control.

    1.how to get selected Thumbnail viewer control item or item index.

    2. i want to implement delete option in Thumbnail viewer control for selected item on right click event.  whenever the user right click on selected Thumbnail viewer control  and should show delete option.

    3.I want to rearrange the ImageMan Viewer control items index. how to implement that. suppose if the user want to move  item3 (index position 2) to first   (index position 0)

     

     

     

     

  • 01-21-2010 2:47 PM In reply to

    • brianb
    • Top 10 Contributor
    • Joined on 09-29-2009
    • Burnsville, NC
    • Posts 58

    Re: how to get selected Thumbnail viewer control item or item index

    rangasamy007:

    1.how to get selected Thumbnail viewer control item or item index.

    The ThumbnailViewer class has a MouseClick event which you can subcribe to by:

    • Open your form to design view in Visual Studio
    • Right click on the Thumbnail control
    • Select Properties in the context menu
    • Go to the Events for the Thumbnail control
    • Double click on the MouseClick event to have Visual Studio automatically create the event for you

    The ThumbClickEventArgs argument has a lot of useful properties.  One of them is the index of the currently selected Thumbnail.

     

    rangasamy007:

    2. i want to implement delete option in Thumbnail viewer control for selected item on right click event.  whenever the user right click on selected Thumbnail viewer control  and should show delete option.

    You can easily add a context menu to the Thumbnail control and have it only display when the mouse is over a Thumbnail (as opposed to also being visible when it's over the space between Thumbnails).  Here's some example VB.Net Code:

    Private Sub ThumbNailViewer1_MouseUp( _
        ByVal sender As System.Object, _
        ByVal e As System.Windows.Forms.MouseEventArgs) Handles ThumbNailViewer1.MouseUp

        If e.Button = Windows.Forms.MouseButtons.Right And _
            ThumbNailViewer1.GetThumbnailFromPosition(e.X, e.Y) IsNot Nothing Then
            ContextMenuStrip1.Visible = True
        Else
            ContextMenuStrip1.Visible = False
        End If

    End Sub

    You just have to subscribe to the MouseUp event for the Thumbnail control and add a ContextMenuStrip to your form.  Then add a new menu item to the ContextMenuStrip. The Click event for that menu strip can hold the logic you write to remove a Thumbnail from the collection you are using to store the images you are hosting on the Thumbnail control.    You can use the Viewer1.Images.RemoveAt() method, for instance (making sure you pass in the index of the selected Thumbnail).

     

    rangasamy007:

    3.I want to rearrange the ImageMan Viewer control items index. how to implement that. suppose if the user want to move  item3 (index position 2) to first   (index position 0)

    I don't have any example code to perform the actual exchanging of positions but I do have a blog post that describes how to wire up drag and drop on the Thumbnail control.  From there you can come up with the logic to do the actual swapping.  Here's a link to that post:

    http://www.data-tech.com/blog/post/Drag-and-Drop-with-the-ImageManNET-WinForms-Controls.aspx

    Thanks for your using our components and please let me know if you have any other questions.

    Brian
    Technical Support
    Data Techniques
    Support Options

    Knowledgebase

    Forums
Page 1 of 1 (2 items)
Copyright 2009 Data Techniques, Inc. All Rights Reserved.