Results 1 to 5 of 5

Thread: When Adding Dynamic Controls, Drawn Below Other Controls

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    5

    Exclamation When Adding Dynamic Controls, Drawn Below Other Controls

    I am trying to add dynamic buttons to a form that has a map, and I want to add these buttons on top of the map, but when the system draws them they are drawn below the map. In fact, they are drawn underneath any static control that is already in the form. Is there some parameter I can set in order for these to be drawn on top, since my user needs to see them? Thanks for any help.

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: When Adding Dynamic Controls, Drawn Below Other Controls

    Have you tried
    VB Code:
    1. [Control].BringToFront
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  3. #3
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: When Adding Dynamic Controls, Drawn Below Other Controls

    Are you setting the location property of the control before you are adding them to the collection? If you are dynamically adding them, you have to position them yourself or else its going to pick a spot for you...

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    5

    Re: When Adding Dynamic Controls, Drawn Below Other Controls

    The BringToFront command doesn't work to bring it to the front when you are declaring it dynamically, but after you add it to the form and then call it it works. I wish I knew to set the z-order (the order in which the controls are drawn ) directly, but this seems to work just fine for this project. Thanks for the help.

    -Dave

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,448

    Re: When Adding Dynamic Controls, Drawn Below Other Controls

    Of course it won't work until the control is on the form. You can't bring something to the front of a stack that it isn't part of. There is no property you can set for the z-order. You can just call BringToFront or SendToBack on your controls in the appropriate sequence to set the z-order.

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