pictureboxes and ovals, want ovals to be in front of pictureboxes
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: pictureboxes and ovals, want ovals to be in front of pictureboxes

  1. #1
    Join Date
    Jun 2012
    Posts
    3

    pictureboxes and ovals, want ovals to be in front of pictureboxes

    I am creating a photo hunt game for grades 6-9 in summer camp. I want them to alter an image in paint then create two picture boxes. I want to put in ovals with no fill color to mark the differences in the picture but VB.net won't let me send the images behind the ovals. this should be a very simple solution but can't find it. thanks.
    terry

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,090

    Re: pictureboxes and ovals, want ovals to be in front of pictureboxes

    Welcome to the forums

    You cannot send the images to the back of the ovals. It should be the other way around. The picture should be in the picturebox, and the Ovals should be drawn onto the picture

  3. #3
    Join Date
    Jun 2012
    Posts
    3

    Re: pictureboxes and ovals, want ovals to be in front of pictureboxes

    Quote Originally Posted by HanneSThEGreaT View Post
    Welcome to the forums

    You cannot send the images to the back of the ovals. It should be the other way around. The picture should be in the picturebox, and the Ovals should be drawn onto the picture

    That is the issue. Visual Basic.net 2010 will not allow the ovals to be in front of the image. when I drow them on the screen, they automatically go behind the picture box. I can right click the picturebox and say send to back but nothing happens. There is no right click on the ovals. I want to make the ovals appear when clicked (change the border size and color on the click event) to "circle" the difference in the pictures for a picture hunt game. can you think of any other way of getting this done?
    thanks a bunch.
    T

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: pictureboxes and ovals, want ovals to be in front of pictureboxes

    Have you tried ..
    Code:
            PictureBox1.Controls.Add(OvalControl)
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,090

    Re: pictureboxes and ovals, want ovals to be in front of pictureboxes

    Quote Originally Posted by tmullin View Post
    That is the issue. Visual Basic.net 2010 will not allow the ovals to be in front of the image. when I drow them on the screen, they automatically go behind the picture box. I can right click the picturebox and say send to back but nothing happens. There is no right click on the ovals. I want to make the ovals appear when clicked (change the border size and color on the click event) to "circle" the difference in the pictures for a picture hunt game. can you think of any other way of getting this done?
    thanks a bunch.
    T
    Then something is being done wrong.

    Have a look at the attachment, see if that helps you

    I basically did this :

    Code:
        Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
            Dim x As Integer = e.X
            Dim y As Integer = e.Y
    
            Dim gg As Graphics = Me.PictureBox1.CreateGraphics
    
            gg.DrawEllipse(Pens.AliceBlue, x, y, 20, 20)
        End Sub
    Attached Files Attached Files

  6. #6
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: pictureboxes and ovals, want ovals to be in front of pictureboxes

    Ahh OK .. see now ....

    Yes Hannes has hit it spot on...

    Your drawing the Ovals on the form itself.. They are not controls on the form but rather part of the Form itself... You need to draw them on the Picturebox itself.. Like Hannes demonstrates...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center