具有原色和背景的面板/标签闪烁会减慢我的表单的速度

时间:2019-04-25 18:31:30

标签: vb.net winforms

当我禁用标签和面板时,为什么我的面板/标签与BackColor一起闪烁,并且我的表单又迟钝又闪烁。我已经将DoubleBuffering设置为TRUE,但是它一直闪烁。我意识到,当我删除图像时,它不会闪烁,因为我的面板和标签未与bnackground图像重叠。我的图片是1920x698分辨率。

enter image description here

代码

 Private Sub FrmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        createfolder("reports")
        FrmLogin.Hide()
        Me.DoubleBuffered = True


        AverageLandingPanel.BackColor = Color.FromArgb(50, 0, 0, 0)
        PopularDestinationPanel.BackColor = Color.FromArgb(50, 0, 0, 0)
        MostFlownAfctTxt.BackColor = Color.FromArgb(50, 0, 0, 0)
        TtlMilesTxt.BackColor = Color.FromArgb(50, 0, 0, 0)



        'UiFunctions.Startup()
        Try
            'DBFunctions.sendlogin()
        Catch ex As Exception

        End Try

    End Sub
    ```

1 个答案:

答案 0 :(得分:0)

您可以在启用DoubleBuffering的情况下创建自定义面板。在此示例中,我在表格上放置了一个表格布局面板,并将自定义面板添加到col0 row0

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim _Panel As New CustomPanel
    TableLayoutPanel1.Controls.Add(_Panel, 0, 0)
End Sub

Public Class CustomPanel
    Inherits Panel

    Public Sub New()
        DoubleBuffered = True
        Dock = DockStyle.Fill
        BackColor = Color.Red
    End Sub

End Class