I am developing LEDBOARD user control in vb.net.I have done it also .Actually its taking too much time to load .In the vb6 same application I am loading 3000 labels using a label control array but not time consuming .In vb.net I am doing same but it's taking too much time to load 3000 labels.Is there any other way(any control or any custom control) to draw input text(any font style),image like below image
It looks like below
Asked
Active
Viewed 2,061 times
-1

Coder Guru
- 513
- 3
- 18
- 37
-
possible duplicate of [vb.net taking too much time to load user control containing Label control array](http://stackoverflow.com/questions/8601700/vb-net-taking-too-much-time-to-load-user-control-containing-label-control-array) – Cody Gray - on strike Dec 23 '11 at 10:15
-
You [already asked this question](http://stackoverflow.com/questions/8601700/vb-net-taking-too-much-time-to-load-user-control-containing-label-control-array). If you want to include additional details, you should edit that question to include them, not ask a new one. – Cody Gray - on strike Dec 23 '11 at 10:15
-
@CodyGray yes sir its same problem but i want to explore it by using image so that i can get better idea to show same output using different ideas – Coder Guru Dec 23 '11 at 10:26
-
It helps if you actually read what people say: *"If you want to include additional details, you should edit that question to include them, not ask a new one."* – Cody Gray - on strike Dec 23 '11 at 11:09
1 Answers
1
Create your LedBoard control from scratch by inheriting from Control
, instead of using a UserControl and adding tons of labels.
I just made a little test to show you what I mean. You will have to adapt the logic to meet your needs.
Public Class LedBoard
Inherits Control
Private _rand As Random = New Random()
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.FillRectangle(Brushes.Black, 0, 0, Width, Height)
Const nx As Integer = 40, ny As Integer = 25
Dim w = CInt((Width - 1) / nx) - 1
Dim h = CInt((Height - 1) / ny) - 1
For x As Integer = 0 To nx - 1
For y As Integer = 0 To ny - 1
If _rand.NextDouble() < 0.8 Then
e.Graphics.FillRectangle(Brushes.Red, x * (w + 1) + 1, y * (h + 1) + 1, w, h)
End If
Next
Next
End Sub
End Class

Olivier Jacot-Descombes
- 104,806
- 13
- 138
- 188
-
Note: All classes of the current solution inheriting from `Control` automatically appear at the top of the toolbox and you can drag them to a form. – Olivier Jacot-Descombes Dec 24 '11 at 16:14
-
Thank you Olivier Jacot-Descombes and cody gray .Actually i also came to solution same like you and output is much like above but only i am not getting lines which are separated like blockes.In above pictures there are 5 vertical lines and 1 horizontal line – Coder Guru Dec 26 '11 at 05:56