Solved

Using Layer's When Design

Posted on 2002-06-03
7
138 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 142

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 69

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now