我正在尝试制作动画,但在运行时会引发错误。
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("dwmapi.dll")>
Private Shared Sub DwmGetColorizationColor(ByRef ColorizationColor As UInteger, ByRef ColorizationOpaqueBlend As Boolean)
End Sub
Private Function UintToColor(ByVal argb As UInteger)
Dim bytes As Byte() = BitConverter.GetBytes(argb)
Dim b = bytes(0)
Dim g = bytes(1)
Dim r = bytes(2)
Dim a = bytes(3)
Dim result As Color = Color.FromArgb(a, r, g, b)
Return result
End Function
Dim windowColor
Dim windowBlend
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Show()
DwmGetColorizationColor(windowColor, windowBlend)
Me.BackColor = UintToColor(windowColor)
End Sub
End Class
并提出这个:/任何人都知道如何解决?
self.__animation = QPropertyAnimation(self, "geometry")
答案 0 :(得分:1)
您必须使用bytearray
,而不是str
:
self.__animation = QPropertyAnimation(self, b'geometry')