By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,582 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,582 IT Pros & Developers. It's quick & easy.

Programatically created label stays invisible. Why?

P: n/a
Decided to try and do it this way just to see if I could. My form appears
with a rectangular hole in the center the size of my label. can anyone tell
me why, and if it can be made visible?

Thanks, Sean

Sub Main()

'Create and format splash form

Dim frmSplash As New Form()

Dim SplashRect As New Rectangle(0, 0, 360, 252)

Dim lblSplashIntro As New Label()

frmSplash.DesktopBounds = SplashRect

frmSplash.FormBorderStyle = FormBorderStyle.None

frmSplash.BackColor = System.Drawing.Color.LightSteelBlue

frmSplash.StartPosition = FormStartPosition.CenterScreen

frmSplash.TopMost = True

lblSplashIntro.Font = New System.Drawing.Font _

("Tahoma", 15.75!, _

System.Drawing.FontStyle.Regular, _

System.Drawing.GraphicsUnit.Point, CType(0, Byte))

lblSplashIntro.Text = "Hey, where am I !!"

lblSplashIntro.Location = New Point(50, 100)

lblSplashIntro.Size = New Size(260, 50)

lblSplashIntro.BackColor = System.Drawing.Color.LightSteelBlue

lblSplashIntro.Enabled = True

lblSplashIntro.Visible = True

frmSplash.Controls.Add(lblSplashIntro)

frmSplash.Show()

'Sleeps for 3 seconds to display splash form

Thread.CurrentThread.Sleep(3000)

frmSplash.Close()

End Sub
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"What-a-Tool" <Fr***********************@cox.net> schrieb
Decided to try and do it this way just to see if I could. My form
appears with a rectangular hole in the center the size of my label.
can anyone tell me why, and if it can be made visible?

[...]
frmSplash.Show()

'Sleeps for 3 seconds to display splash form

Thread.CurrentThread.Sleep(3000)

When you put the thread to sleep, the splash form is not painted.

To force it to repaint itself immediatelly, call
frmSpash.Refresh
directly after calling Show.

frmSplash.Close()

End Sub

--
Armin

Nov 20 '05 #2

P: n/a
Hello,

"What-a-Tool" <Fr***********************@cox.net> schrieb:
Decided to try and do it this way just to see if I could. My
form appears with a rectangular hole in the center the size of my
label. can anyone tell me why, and if it can be made visible?
Are you sure the 'TransparencyKey' property of the form is not set?
frmSplash.Controls.Add(lblSplashIntro)

frmSplash.Show()
Call 'lblSplashIntro.Refresh' or 'frmSplash.Refresh' here.
'Sleeps for 3 seconds to display splash form

Thread.CurrentThread.Sleep(3000)


--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3

P: n/a
..Refresh() did the trick - Your the best - Thanks

"What-a-Tool" <Fr***********************@cox.net> wrote in message
news:xCXab.65$0Z5.15@lakeread03...
Decided to try and do it this way just to see if I could. My form appears
with a rectangular hole in the center the size of my label. can anyone tell me why, and if it can be made visible?

Thanks, Sean

Sub Main()

'Create and format splash form

Dim frmSplash As New Form()

Dim SplashRect As New Rectangle(0, 0, 360, 252)

Dim lblSplashIntro As New Label()

frmSplash.DesktopBounds = SplashRect

frmSplash.FormBorderStyle = FormBorderStyle.None

frmSplash.BackColor = System.Drawing.Color.LightSteelBlue

frmSplash.StartPosition = FormStartPosition.CenterScreen

frmSplash.TopMost = True

lblSplashIntro.Font = New System.Drawing.Font _

("Tahoma", 15.75!, _

System.Drawing.FontStyle.Regular, _

System.Drawing.GraphicsUnit.Point, CType(0, Byte))

lblSplashIntro.Text = "Hey, where am I !!"

lblSplashIntro.Location = New Point(50, 100)

lblSplashIntro.Size = New Size(260, 50)

lblSplashIntro.BackColor = System.Drawing.Color.LightSteelBlue

lblSplashIntro.Enabled = True

lblSplashIntro.Visible = True

frmSplash.Controls.Add(lblSplashIntro)

frmSplash.Show()

'Sleeps for 3 seconds to display splash form

Thread.CurrentThread.Sleep(3000)

frmSplash.Close()

End Sub

Nov 20 '05 #4

P: n/a
..Refresh() did the trick - Your the best - Thanks

"What-a-Tool" <Fr***********************@cox.net> wrote in message
news:xCXab.65$0Z5.15@lakeread03...
Decided to try and do it this way just to see if I could. My form appears
with a rectangular hole in the center the size of my label. can anyone tell me why, and if it can be made visible?

Thanks, Sean

Sub Main()

'Create and format splash form

Dim frmSplash As New Form()

Dim SplashRect As New Rectangle(0, 0, 360, 252)

Dim lblSplashIntro As New Label()

frmSplash.DesktopBounds = SplashRect

frmSplash.FormBorderStyle = FormBorderStyle.None

frmSplash.BackColor = System.Drawing.Color.LightSteelBlue

frmSplash.StartPosition = FormStartPosition.CenterScreen

frmSplash.TopMost = True

lblSplashIntro.Font = New System.Drawing.Font _

("Tahoma", 15.75!, _

System.Drawing.FontStyle.Regular, _

System.Drawing.GraphicsUnit.Point, CType(0, Byte))

lblSplashIntro.Text = "Hey, where am I !!"

lblSplashIntro.Location = New Point(50, 100)

lblSplashIntro.Size = New Size(260, 50)

lblSplashIntro.BackColor = System.Drawing.Color.LightSteelBlue

lblSplashIntro.Enabled = True

lblSplashIntro.Visible = True

frmSplash.Controls.Add(lblSplashIntro)

frmSplash.Show()

'Sleeps for 3 seconds to display splash form

Thread.CurrentThread.Sleep(3000)

frmSplash.Close()

End Sub

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.