CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Location
    California
    Posts
    264

    Why can't I put Label control to the front of other controls?

    I have several control in a form. I can set button... to the front of other controls. Why can't I put Label control to the front of other controls?

    Thank you!

    Best Regards,

    Kevin Shen
    Best Regards,

    Kevin Shen

  2. #2
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: Why can't I put Label control to the front of other controls?

    You just can't. Labels are lowest in importance when it comes to zorder. You can always use a textbox to simulate a label by setting its borderstyle to none and its backcolor to that of the form, then you can use zorder to put it infront of the other controls


  3. #3
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Why can't I put Label control to the front of other controls?

    I'm afraid that labels, lines, shapes and image controls are not true windows.
    When Visual Basic was originally developed there was a fairly low limit on the number of actual windows that could exist at any given time. In order to ease the pressure the designers of VB added what they called "lightweight" controls which are not true controls at all but rather are drawn by the form itself.
    One of the side effects of this is that the form cannot draw over other "real" controls, so lightweight controls always lie underneath true window controls.
    There are third part controls which pretend to be a label but can float over other controls, and you can make such a control yourself in Visual basic 5 and above by adding a UserControl to your project and using the control creation wizard to give it all the properties and methods of a VB label.
    This new control will then support the Z-Order functionality.

    HTH,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Why can't I put Label control to the front of other controls?

    Find the Zorder method in the Help files. The last couple of paragraphs define the Windows layers in detail and the "Importance" level of each control.

    John G

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

Featured