Hallo Community !
Ich habe vor ein LED-Display zu coden, um Klassensysteme kennenzulernen.
Ich habe das ganze logischerweise als neue .dll erstellt, und darin eine Class für UserControls.
Die Aufmachung funktioniert soweit, die (De-)Aktivierung eines Punktes auch, Texteingabe ist in Arbeit, aber:
Display ist tierisch langsam / laggy, es ist mir kaum möglich das Display auf der Form richtig einzustellen.
Hier mein OnPaint-Sub, aber ich weiß nicht wie ich das vereinfachen soll, weil das ja alles neu gezeichnet werden muss :
Ich habe vor ein LED-Display zu coden, um Klassensysteme kennenzulernen.
Ich habe das ganze logischerweise als neue .dll erstellt, und darin eine Class für UserControls.
Die Aufmachung funktioniert soweit, die (De-)Aktivierung eines Punktes auch, Texteingabe ist in Arbeit, aber:
Display ist tierisch langsam / laggy, es ist mir kaum möglich das Display auf der Form richtig einzustellen.
Hier mein OnPaint-Sub, aber ich weiß nicht wie ich das vereinfachen soll, weil das ja alles neu gezeichnet werden muss :
VB.NET-Quellcode
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim graph As Graphics = e.Graphics
- 'Background
- graph.FillRectangle(New SolidBrush(my_backcolor), 0, 0, Me.Width, Me.Height) 'Dim my_backcolor As Color = Color.Black
- 'Circles
- For x As Integer = 1 To my_status.GetUpperBound(0) 'Dim my_status(2000, 1000) As Boolean --> Status einer einzelnen Lampe
- For y As Integer = 1 To my_status.GetUpperBound(1) ' True = An - False = Aus
- Dim sb As SolidBrush
- If my_status(x, y) = False Then
- sb = New SolidBrush(Color.FromArgb(230, my_inactivecolor)) 'Dim my_inactivecolor As Color = Color.FromARGB(14,55,14)
- Else
- sb = New SolidBrush(Color.FromArgb(230, my_activecolor)) 'Dim my_activecolor As Color = Color.Green
- End If
- Dim ptx As Integer = my_circlemargin + (my_circlediameter + my_circlemargin) * (x - 1) 'my_circlemagin = Abstand zwischen den "LEDs" = 1
- Dim pty As Integer = my_circlemargin + (my_circlediameter + my_circlemargin) * (y - 1) 'my_circlediameter = Durchmesser eines "LEDs" = 7
- graph.FillEllipse(sb, ptx, pty, my_circlediameter, my_circlediameter)
- Next
- Next
- graph.Dispose()
- End Sub
»There's no need to "teach" atheism. It's the natural result of education without indoctrination.« — Ricky Gervais