Solved

Using Layer's When Design

Posted on 2002-06-03
7
143 Views
Last Modified: 2012-05-04
Hi ,

I wanna put one Control over another.
for EX : To Put a label Over DataGrid.

Each time i'm trying to put it . VB6 puts it under the control.

there is any way to set showing order ?
0
Comment
Question by:computech1
7 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7051581
Yes, by putting the label onto a frame or picturebox or image control.
You could of course also simply replace the label by the textbox by choosing the textbox properties so it looks like the label with the selecting option added:
* backcolor
* locked
* borderstyle

CHeers
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7051618
a label cannot be placed over a grid because the label is a passive control. Use a textbox instead and use Text2.ZOrder 0 to set it over.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7051620
there are some controls that don't really are "controls" but only "drawing region" that VB runtime manages like controls.
label control is one of them (Image control also ;)
You better follow angel's suggestion regarding textbox.
To hide the caret, you could use API:

Declare Function HideCaret Lib "user32" _
(ByVal hWnd as Long) As Long

Then set the Gotfocus event in the text Box as follows

Private Sub Text1_GotFocus()
HideCaret (Text1.hWnd)
End Sub
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
rspahitz earned 50 total points
ID: 7051659
According to the Microsoft help files, there are three major layers on a form:

1) The picture layer
2) The drawing layer
3) The control layer

Anything on the lower layers can never appear on top of anything at a higher layer, but within a layer you can set a Z-order layer.

The picture layer consists of the pixels that produce a "background" image.

The drawing layer consists of drawn controls that do not contain device contexts.  Labels, image controls, shapes and line controls are included in this category.  These controls are referred to as lightweight controls.  These have the ability to have transparent regions since they are simply drawn onto the form.

The control layer consists of controls that have device contexts. Most controls are included in this category.  These are referred to as heavyweight controls.  These cannot truly have transparent regions (although it can be simulated) since they have their own separate drawing context (region.)

Any object within a layer can be brought to the front of that layer or pushed to the back of that layer.  The "lowest" item in the control layer will always be "higher" than the highest item in the drawing layer.

--
As indicated above, a simple solution to your problem is to either replace the label (lightweight) with a textbox (heavyweight) or to place the label into a heavyweight container such as a frame or picturebox.  An alternate solution is to find a lightweight grid control, although I don't know of any and I suspect that they don't currently exist.
0
 

Author Comment

by:computech1
ID: 7055525
10x rspahitz,

i'll put the label within picturebox
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7056215
Holy smoke!
:))
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7056773
Thanks, computech1, but I think angelIII should have gotten the points.  My comment was for information, but angelIII's comment has an answer to your problem.

If you'd like to correct this, please drop a zero-point Question in the customer support area and reference this Q.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 127
VBA error replacing data 6 41
fso.FolderExists("\\server\HiddenFolder$") 4 87
Formula problem with Excel attachment 6 43
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question