即时尝试更改自定义控件的进度栏的颜色。香港专业教育学院tryed不少methords像使用下面的sendingmessage功能:进度条更改颜色
<DllImport("User32.Dll")> _ Public Shared Function SendMessage(hwnd As Integer, wMsg As Integer, wParam As Integer, lParam As Integer) As Integer End Function
Public Const PBM_SETBKCOLOR As Integer = &H2001
Public Const PBM_SETBARCOLOR As Integer = &H409
Public Sub SetProgressBackColor(c As Color)
Dim a As Integer = Convert.ToInt32(c.R.ToString())
Dim b As Integer = Convert.ToInt32(c.G.ToString())
Dim d As Integer = Convert.ToInt32(c.B.ToString())
Dim tot As Integer = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString())
Dim j As Integer = Me.PercentFull.Handle.ToInt32()
SendMessage(j, PBM_SETBKCOLOR, 0, tot)
End Sub
Public Sub SetProgressForeColor(c As Color)
Dim a As Integer = Convert.ToInt32(c.R.ToString())
Dim b As Integer = Convert.ToInt32(c.G.ToString())
Dim d As Integer = Convert.ToInt32(c.B.ToString())
Dim tot As Integer = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString())
Dim j As Integer = Me.PercentFull.Handle.ToInt32()
SendMessage(j, PBM_SETBARCOLOR, 0, tot)
End Sub
,但对我来说这没有工作我couldent看到任何改变。
什么将是我改变这种控制的前景的最佳方式?我无法使用PercentFull.ForeColor,因为我将启用xp样式。
谢谢
没有,但它是一个自定义的控制,所以我不必须禁用XP样式的选项。这个控制也可以用于XP机器。谢谢。 – Houlahan