le code suivant est supposé remplacer la couleur du système utilisée pour les arrière-plans de fenêtre. Vous le modifieriez en appelant la fonction API SetSysColor(). J'utilise le code suivant qui m'a été suggéré mais malheureusement quand je clique sur le bouton rien ne se passe!remplacer la couleur du système dans les arrière-plans de fenêtres
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Namespace WindowsFormsApplication1
Partial Public Class Form1
Inherits Form
Private oldcolor As Integer
Public Sub New()
InitializeComponent()
oldcolor = GetSysColor(COLOR_WINDOW)
AddHandler Me.FormClosed, AddressOf Form1_FormClosed
AddHandler Me.button1.Click, AddressOf button1_Click
End Sub
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As FormClosedEventArgs) Handles MyBase.FormClosed
Dim element As Integer = COLOR_WINDOW
SetSysColors(1, element, oldcolor)
End Sub
Private Function Color2COLORREF(ByVal color As Color) As Integer
Return color.R Or (color.G << 8) Or (color.B << &H10)
End Function
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim element As Integer = COLOR_WINDOW
Dim colorref As Integer = Color2COLORREF(Color.NavajoWhite)
SetSysColors(1, element, colorref)
End Sub
Private Const COLOR_WINDOW As Integer = 5
<DllImport("user32.dll")> _
Private Shared Function SetSysColors(ByVal one As Integer, ByRef element As Integer, ByRef color As Integer) As Boolean
End Function
<DllImport("user32.dll")> _
Private Shared Function GetSysColor(ByVal element As Integer) As Integer
End Function
Friend WithEvents Button1 As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(71, 61)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(153, 126)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Form1
'
Me.ClientSize = New System.Drawing.Size(284, 264)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.ResumeLayout(False)
End Sub
End Class
End Namespace
je veux que cela fonctionne comme ici: http://www.thomson-software-solutions.com/html/screen_tinter.html –
je vous remercie très très très beaucoup. tout le meilleur pour vous –
comment avez-vous supprimé vos commentaires? –