vb.net LED板显示屏用户控制

发布于 2024-12-22 12:22:22 字数 296 浏览 2 评论 0原文

我正在 vb.net 中开发 LEDBOARD 用户控件。我也这样做了。实际上,加载时间太长。在 vb6 同一应用程序中,我使用标签控件数组加载 3000 个标签,但没有耗时。在vb.net中我也在做同样的事情,但是加载3000个标签花费了太多时间。还有其他方式(任何控件或任何自定义控件)来绘制输入文本(任何字体样式),图像如下图 它看起来像下面在此处输入图像描述

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 belowenter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

征棹 2024-12-29 12:22:22

通过继承 Control 从头开始​​创建 LedBoard 控件,而不是使用 UserControl 并添加大量标签。

我只是做了一个小测试来告诉你我的意思。您必须调整逻辑以满足您的需求。

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文