Solved

ZOrder Problem in VB6

Posted on 2004-08-02
5
3,868 Views
Last Modified: 2008-03-04
Hi!
I have A picturebox and several labels in my app, the labels are NOT children of the picturebox.
I want to load the picturebox during runtime first, and then load the labels, onto it, but when I load them they are loaded behind the picturebox and I cant see them.
I tried using Zorder(1) to position the picturebox behind the labels but it wouldn't work. Why?
And how do I load the labels onto the box so they will be in the front without making them the children of the picturebox?
Thanks.
0
Comment
Question by:NightBlader
  • 3
5 Comments
 
LVL 4

Expert Comment

by:SSSoftware
ID: 11693030
Labels and lines are basic constructs and reside at a different drawing plane that more extensive controls.

Therefore: using the ZOrder has no effect. I'm not event sure it has an effect within the drawing plane.

I Suggest you use another picturebox to to lable your picture.

Ed
0
 

Author Comment

by:NightBlader
ID: 11693075
Then there is no way to bring them to the front?
0
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 125 total points
ID: 11693189
Why wouldn't you want them to be children of the PictureBox? You can always toggle between the Labels' containers.

Form1:
------------
Option Explicit

Private ctrlLabel As Label
Private Sub Command1_Click()
    'set the label's container back to the form...
    Set ctrlLabel.Container = Form1
End Sub
Private Sub Form_Load()
    With Picture1
        .Left = 0
        .Top = 0
    End With
    Set ctrlLabel = Me.Controls.Add("VB.Label", "MyLabel1")
    ctrlLabel.Caption = "MyLabel1"
    ctrlLabel.Visible = True
    Set ctrlLabel.Container = Picture1
End Sub
0
 

Author Comment

by:NightBlader
ID: 11693299
I didnt know I could change the container of the label at any time, I didnt want it to be a child because I have to change it's container.
I suppose it will work, Ill try it now, Thanks!
0
 

Author Comment

by:NightBlader
ID: 11693330
Yep, it works, thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 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

25 Experts available now in Live!

Get 1:1 Help Now