Solved

Using Layer's When Design

Posted on 2002-06-03
7
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

734 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