Solved

ZOrder Problem in VB6

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

758 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

14 Experts available now in Live!

Get 1:1 Help Now