Results 1 to 13 of 13

Thread: [RESOLVED] Always on Top

  1. #1

    Thread Starter
    Addicted Member ajames's Avatar
    Join Date
    Mar 2005
    Location
    Wales, UK
    Posts
    178

    Resolved [RESOLVED] Always on Top

    I couldn't think of what I'd need to search for to find this, "always on top" always seems to have had more to do with the window than what I want:

    I am making a weather-station creation program which gives you a standard weather station reading (like a circle with a line coming out of it).

    However, the picture of the circle in the middle (which indicates cloud cover based on different fillings) has a box around it, which seems to swallow up anything else within it. To illustrate my point:

    Code:
    Here, the X is fine:
    ______
          | X
          |
          |
    
    But if it's here, the white part of the picturebox makes the X go underneath it:
    ______
         X| 
          |
          |
    What I'd like to know is this: Is there any way to make a control always be over an image, rather than under it? When I use the "Send to back" button on the image, the control which overlaps the picture always goes underneath it, rather than logically staying on top.

    How would I keep the control on top of the picture rather than under it?

  2. #2
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Always on Top

    I think if you change the .ZOrder of the controls, it will set it up properly

    Picturebox1.ZOrder = 1
    Label1.ZOrder = 0 (or whatever control you are using for your "X")

    "0" Being the top most control
    "1" Being the second control, etc..


    Pardon me if I am incorrect, but I think I had to do this same thing in a project once.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Always on Top

    Control.ZOrder 0

    so.. for a command button
    Command1.ZOrder 0
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Always on Top

    Windowed controls (CommandButton, TextBox, PictureBox, ListBox, etc) will always be higher in the ZOrder than lightweight controls (Label, Shape, Line, etc) - that could be causing your problem (since you haven't stated what controls you're using)

  5. #5
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Always on Top

    good point... didnt think about lowly labels....
    if you need a label try a locked texbox with no border etc.. or put the label in another picbox
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  6. #6

    Thread Starter
    Addicted Member ajames's Avatar
    Join Date
    Mar 2005
    Location
    Wales, UK
    Posts
    178

    Re: Always on Top

    Quote Originally Posted by bushmobile
    Windowed controls (CommandButton, TextBox, PictureBox, ListBox, etc) will always be higher in the ZOrder than lightweight controls (Label, Shape, Line, etc) - that could be causing your problem (since you haven't stated what controls you're using)
    I'm using pictureboxes and lines. Can the zOrder do anything to aid with this?

  7. #7
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Always on Top

    did you try it? it has a ZOrder setting.... see what happens when you try it



    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Always on Top

    Lines are windowless, so you'll have to put them in a picturebox (or put each one in a separate picturebox, depending on what you're doing with them).
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  9. #9
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Always on Top

    i wanted him to try it before posting to ask if it will work....
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  10. #10

    Thread Starter
    Addicted Member ajames's Avatar
    Join Date
    Mar 2005
    Location
    Wales, UK
    Posts
    178

    Re: Always on Top

    My code:

    lluncyfeiriad(1).ZOrder 0
    llunoctau(1).ZOrder 1

    llunoctau still appears above lluncyfeiriad, which is why I asked whether it did anything (I should have actually said, sorry )

  11. #11

    Thread Starter
    Addicted Member ajames's Avatar
    Join Date
    Mar 2005
    Location
    Wales, UK
    Posts
    178

    Re: Always on Top

    Anyone?

  12. #12
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Always on Top

    The line you are trying to move in and out of the picturebox....What you could do is cut and paste that same line directly into the Picturebox control. That will keep it within the borders and on top. Then, just move it outside of the visible parameters to make it "disappear"
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  13. #13

    Thread Starter
    Addicted Member ajames's Avatar
    Join Date
    Mar 2005
    Location
    Wales, UK
    Posts
    178

    Re: Always on Top

    That makes sense actually - (I'm not near vb6 at the moment) - I'm presuming you have to refer to the line as "picture1.line(0)"?

    EDIT: Just tried it, it works
    Last edited by ajames; Mar 2nd, 2007 at 03:14 PM.

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