728x90
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 배경색)
열거형이 싫다면 정수형 숫자만으로도 작성하실 수 있습니다.
728x90
'.NET > Windows API for .NET' 카테고리의 다른 글
CreateDirectory - Directory의 생성 (0) | 2019.08.05 |
---|---|
GetDriveType - Disk Drive 유형 판단 (0) | 2019.08.05 |
MoveFile - File의 이동및 복사수행 (0) | 2019.07.31 |
IsWindowVisible - 특정 Window가 현재 화면에 보이는지 여부를 판단 (0) | 2019.07.31 |
PaintDesktop - 배경화면 맞추기 (0) | 2019.07.31 |