Click to See Complete Forum and Search --> : Why can't I put Label control to the front of other controls?


kevin shen
April 18th, 2001, 09:36 PM
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

TH1
April 19th, 2001, 02:24 AM
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

Clearcode
April 19th, 2001, 03:45 AM
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

John G Duffy
April 19th, 2001, 09:13 AM
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