• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

Using Layer's When Design

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
computech1
Asked:
computech1
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
Richie_SimonettiIT OperationsCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
rspahitzCommented:
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
 
computech1Author Commented:
10x rspahitz,

i'll put the label within picturebox
0
 
Richie_SimonettiIT OperationsCommented:
Holy smoke!
:))
0
 
rspahitzCommented:
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

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now