Solved

ZOrder Problem in VB6

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

Independent Software Vendors: 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!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

730 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