|
-
Aug 6th, 2014, 03:33 PM
#1
Thread Starter
Addicted Member
Missing Label *Solved*
I programatically created a label, but it is not visible. However PanelButton (a panel) does show up.
vb Code:
PanelButton.Parent = Me
PanelButton.Visible = True
PanelButton.Location = New Point(0, 80)
PanelButton.Size = New Size(40, 40)
TextLabel.Parent = PanelButton
TextLabel.Visible = True
TextLabel.Location = PanelButton.Location
TextLabel.AutoSize = False
TextLabel.Size = PanelButton.Size
TextLabel.BringToFront()
TextLabel.BackColor = Color.White
TextLabel.ForeColor = Color.Black
TextLabel.TextAlign = ContentAlignment.MiddleCenter
TextLabel.Text = "?"
Can someone please show me what I'm doing wrong? Thanks
Last edited by NinjaNic; Aug 6th, 2014 at 05:29 PM.
-
Aug 6th, 2014, 03:38 PM
#2
Thread Starter
Addicted Member
Re: Missing Label
Edit: As you can see, the TextLabel's backcolor is set to white, but (not included here) PanelButton's backcolor is set to red. I don't see any white in the red panel.
-
Aug 6th, 2014, 04:15 PM
#3
Re: Missing Label
Code:
TextLabel.Location = PanelButton.Location
PanelButton.Location is (0,80) which would put the label below the PanelButton's client area (its height is only 40), and so it would not be visible.
-
Aug 6th, 2014, 04:18 PM
#4
Thread Starter
Addicted Member
Re: Missing Label
I'm not sure I understand because the label is supposed to have the same location and size, so it should be right on the panel.
-
Aug 6th, 2014, 04:21 PM
#5
Re: Missing Label
the location of a label on a panel is relative to the panel, not the form
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Aug 6th, 2014, 04:53 PM
#6
Re: Missing Label
What Paul said. The location of any control is relative to its Parent.
If you want the label to be positioned at the top left of the panel, you need to specify the label's location as (0,0).
-
Aug 6th, 2014, 05:28 PM
#7
Thread Starter
Addicted Member
Re: Missing Label
Oh, thanks! Because of the parent. I forgot. I feel so stupid, but thanks! It works
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|