Results 1 to 7 of 7

Thread: [RESOLVED] pictureboxes and right click menu

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2012
    Posts
    616

    Resolved [RESOLVED] pictureboxes and right click menu

    We have a situation like this:

    1. 4 picturebox controls
    2. I want to add or remove picture from picturebux using context meny
    3. Contextmenu have to be done with code (no control)

    Code:
      Dim ctxmnu As New ContextMenu
    
            Dim item1 As New MenuItem("Add Picture")
            Dim item2 As New MenuItem("Remove")
    
            AddHandler item1.Click, AddressOf ContextMenuHandler
            AddHandler item2.Click, AddressOf ContextMenuHandler
    
            ctxmnu.MenuItems.Add(i1)
            ctxmnu.MenuItems.Add(i2)

    What we have to do that our program konws which picturebox we want to fill opening fileopen dalog?


    Code:
    	
       Private Sub InputPicture()
            If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
                PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
                PictureBox1.Tag = OpenFileDialog1.FileName
            Else
                OpenFileDialog1.Tag = ""
            End If
        End Sub
    I've tried many things to send an argument via InputPicture() which should point to the picturebox we need but without success.
    Last edited by Goshx; May 18th, 2013 at 09:45 AM.

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