Solved

ZOrder Problem in VB6

Posted on 2004-08-02
5
3,876 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

823 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