Scrollbar arrows are drawn by Theme APIs
A quick test on the main window DC :
int nX = 10;
int nY = 200;
RECT rectTest = new RECT(nX, nY, nX + 30, nY + 30);
IntPtr hTheme = OpenThemeData(this.Handle, "ScrollBar");
if (hTheme != IntPtr.Zero)
{
IntPtr hDC = GetDC(this.Handle);
DrawThemeBackground(hTheme, hDC, (int)SCROLLBARPARTS.SBP_ARROWBTN, (int)ARROWBTNSTATES.ABS_UPNORMAL, ref rectTest, IntPtr.Zero);
rectTest.left += 40;
rectTest.right += 40;
DrawThemeBackground(hTheme, hDC, (int)SCROLLBARPARTS.SBP_ARROWBTN, (int)ARROWBTNSTATES.ABS_UPHOT, ref rectTest, IntPtr.Zero);
rectTest.left += 40;
rectTest.right += 40;
DrawThemeBackground(hTheme, hDC, (int)SCROLLBARPARTS.SBP_ARROWBTN, (int)ARROWBTNSTATES.ABS_UPPRESSED, ref rectTest, IntPtr.Zero);
CloseThemeData(hTheme);
ReleaseDC(this.Handle, hDC);
}
with declarations :
[DllImport("UxTheme.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr OpenThemeData(IntPtr hwnd, string pszClassList);
[DllImport("UxTheme.dll", SetLastError = true)]
public static extern IntPtr GetWindowTheme(IntPtr hwnd);
[DllImport("UxTheme.dll", SetLastError = true)]
public static extern HRESULT CloseThemeData(IntPtr hTheme);
[DllImport("UxTheme.dll", SetLastError = true)]
public extern static HRESULT DrawThemeBackground(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, ref RECT pRect, IntPtr pClipRect);
public enum SCROLLBARPARTS
{
SBP_ARROWBTN = 1,
SBP_THUMBBTNHORZ = 2,
SBP_THUMBBTNVERT = 3,
SBP_LOWERTRACKHORZ = 4,
SBP_UPPERTRACKHORZ = 5,
SBP_LOWERTRACKVERT = 6,
SBP_UPPERTRACKVERT = 7,
SBP_GRIPPERHORZ = 8,
SBP_GRIPPERVERT = 9,
SBP_SIZEBOX = 10,
SBP_SIZEBOXBKGND = 11,
};
public enum ARROWBTNSTATES
{
ABS_UPNORMAL = 1,
ABS_UPHOT = 2,
ABS_UPPRESSED = 3,
ABS_UPDISABLED = 4,
ABS_DOWNNORMAL = 5,
ABS_DOWNHOT = 6,
ABS_DOWNPRESSED = 7,
ABS_DOWNDISABLED = 8,
ABS_LEFTNORMAL = 9,
ABS_LEFTHOT = 10,
ABS_LEFTPRESSED = 11,
ABS_LEFTDISABLED = 12,
ABS_RIGHTNORMAL = 13,
ABS_RIGHTHOT = 14,
ABS_RIGHTPRESSED = 15,
ABS_RIGHTDISABLED = 16,
ABS_UPHOVER = 17,
ABS_DOWNHOVER = 18,
ABS_LEFTHOVER = 19,
ABS_RIGHTHOVER = 20,
};
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
public RECT(int Left, int Top, int Right, int Bottom)
{
left = Left;
top = Top;
right = Right;
bottom = Bottom;
}
}
[DllImport("User32", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern IntPtr GetDC(IntPtr hWnd);
[DllImport("User32", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);