0
次のコードは、ウィンドウの背景に使用されているシステムカラーを置き換えるものです。あなたはP/SetSysColor()API関数を呼び出してそれを変更します。私は私に示唆された次のコードを使用していますが、残念ながらボタンをクリックしても何も起こりません!Windowsの背景のシステムカラーを置き換えます。
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
私はそれがここのように動作します:http://www.thomson-software-solutions.com/html/screen_tinter.html –
非常に非常に非常に非常にありがとう。すべてあなたに最高 –
どのようにあなたのコメントを削除してきた? –