Programming/Windows API
Private Declare Function SetSysColors Lib "user32.dll" (ByVal nChanges As Integer, ByRef lpSysColor As ieSystemColor, ByRef lpColorValues As Integer) As Integer
▶VB.NET 선언

Public Enum ieSystemColor As Integer
        iScrollBar = 0
        iBackGround = 1
        iActiveCaption = 2
        iInactiveCaption = 3
        iMenu = 4
        iWindow = 5
        iWindowFrame = 6
        iMenuText = 7
        iWindowText = 8
        iCaptionText = 9
        iActiveBorder = 10
        iInactiveBorder = 11
        iAppWorkspace = 12
        iHighlight = 13
        iHighlightText = 14
        iBtnFace = 15
        iBtnShadow = 16
        iGrayText = 17
        iBtnText = 18
        iInactiveCaptionText = 19
        iBtnHightList = 20
        iSecondActiveCatpion = 27
        iSecondInactiveCaption = 28
End Enum

SetSysColors(1, ieSystemColor.iBackGround, RGB(0, 0, 0))

▶VB.NET 호출

[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool SetSysColors(int nChanges, int[] lpSysColor, int[] lpColorValues);
▶C# 선언

public enum ieSystemColor : int
{
            iScrollBar = 0,
            iBackGround = 1,
            iActiveCaption = 2,
            iInactiveCaption = 3,
            iMenu = 4,
            iWindow = 5,
            iWindowFrame = 6,
            iMenuText = 7,
            iWindowText = 8,
            iCaptionText = 9,
            iActiveBorder = 10,
            iInactiveBorder = 11,
            iAppWorkspace = 12,
            iHighlight = 13,
            iHighlightText = 14,
            iBtnFace = 15,
            iBtnShadow = 16,
            iGrayText = 17,
            iBtnText = 18,
            iInactiveCaptionText = 19,
            iBtnHightList = 20,
            iSecondActiveCatpion = 27,
            iSecondInactiveCaption = 28
};

int[] systemcolor = { (int)(ieSystemColor.iBackGround) };
int[] color = { System.Drawing.ColorTranslator.ToWin32(System.Drawing.Color.Black) };

SetSysColors(systemcolor.Length, systemcolor, color);

▶C# 호출

SetSysColors를 통해 Windows의 어떤 색상을 바꿀지 열거형을 참고하여 지정합니다.(ex iBackGround : Windows 배경색)

열거형이 싫다면 정수형 숫자만으로도 작성하실 수 있습니다.
0 0