Ejemplo n.º 1
0
BOOL Ctl_CreateBrushes( )
/************************************************************************/
{
WORD Pattern[16];
HBITMAP hBitmap;
int i;

Ctl_hShadowBrush = CreateSolidBrush( Ctl_GetBtnShadowColor() );
Ctl_hButtonBrush = CreateSolidBrush( Ctl_GetBtnFaceColor() );
for ( i=0; i<16; i+=2 )
	Pattern[i] = 0xAAAA;
for ( i=1; i<16; i+=2 )
	Pattern[i] = 0x5555;
hBitmap = CreateBitmap( 16, 16, 1, 1, (LPTR)Pattern );
Ctl_hHilightBrush = CreatePatternBrush( hBitmap );
DeleteObject( hBitmap );
Ctl_hShadowPen = CreatePen( PS_SOLID, 1, Ctl_GetBtnShadowColor());
Ctl_hButtonPen = CreatePen( PS_SOLID, 1, Ctl_GetBtnFaceColor());
return(TRUE);
}
Ejemplo n.º 2
0
LOCAL void Slider_DrawBackground (HWND hWindow, HDC hDC, LPSLIDERINFO lpInfo)
/***********************************************************************/
{
    RECT rClient;
    HBRUSH hBrush;
    RECT rSlider = lpInfo->rPosRange;

    GetClientRect (hWindow,&rClient);
//	Ctl_EraseBackground( hWindow, hDC, &rClient, CTLCOLOR_BTN);
// this makes the slider background color always light gray
    hBrush = (HBRUSH)GetStockObject (LTGRAY_BRUSH);
    FillRect (hDC, &rClient, hBrush);

    if (lpInfo->lStyle & SS_HORZSLIDER)
    {
        rSlider.top = (rClient.bottom / 2) - (lpInfo->GrooveThickness / 2);
        rSlider.bottom = rSlider.top + lpInfo->GrooveThickness;
    }
    else
    {
        rSlider.left = (rClient.right / 2) - (lpInfo->GrooveThickness / 2);
        rSlider.right = rSlider.left + lpInfo->GrooveThickness;
    }
    InflateRect (&rSlider,1,1);
    Ctl_DrawBevel (hDC, Ctl_GetBtnShadowColor(),
                   Ctl_GetBtnHilightColor(),
                   rSlider,1,DB_IN|DB_RECT);
    InflateRect (&rSlider,-1,-1);
    if (lpInfo->lStyle & SS_RIGHTTOLEFT)
        hBrush = CreateSolidBrush (RGB(0, 0, 0));
    else
        hBrush = CreateSolidBrush (RGB(255, 0, 0));
    FillRect (hDC,&rSlider,hBrush);
    DeleteObject (hBrush);
    if (lpInfo->lStyle & SS_HORZSLIDER)
        rSlider.left = lpInfo->ptPosition.x;
    else
        rSlider.top = lpInfo->ptPosition.y;
    if (lpInfo->lStyle & SS_RIGHTTOLEFT)
        hBrush = CreateSolidBrush (RGB(255, 0, 0));
    else
        hBrush = CreateSolidBrush (RGB(0, 0, 0));
    FillRect (hDC,&rSlider,hBrush);
    DeleteObject (hBrush);
}
Ejemplo n.º 3
0
LOCAL void Slider_DrawTicks (HWND hWindow, HDC hDC, LPSLIDERINFO lpInfo)
/***********************************************************************/
{
    HPEN hPen;
    HPEN hOldPen;
    int i;
    POINT ptTick;
    int Offset;
    int Length;

    hPen = CreatePen (PS_SOLID,1,Ctl_GetBtnShadowColor());
    hOldPen = (HPEN)SelectObject (hDC,hPen);

    if ((lpInfo->lStyle & SS_HORZSLIDER) ?
            (lpInfo->lStyle & SS_TICKSBOTTOM) :
            (lpInfo->lStyle & SS_TICKSRIGHT))
        Offset = lpInfo->GrooveThickness / 2 + 3;
    else
        Offset = - lpInfo->GrooveThickness / 2 - 3;
    if (lpInfo->lStyle & SS_HORZSLIDER)
    {
        Length = lpInfo->ThumbHeight / 2;
        if (!(lpInfo->lStyle & SS_TICKSBOTTOM))
            Length = -Length;
    }
    else
    {
        Length = lpInfo->ThumbWidth / 2;
        if (!(lpInfo->lStyle & SS_TICKSRIGHT))
            Length = -Length;
    }
    if (lpInfo->BigTickInc)
    {
        if (lpInfo->lStyle & SS_HORZSLIDER)
        {
            for (i=lpInfo->Min; i<=lpInfo->Max; i+=lpInfo->BigTickInc)
            {
                Slider_PointFromValue (hWindow,i,&ptTick,lpInfo);
                MoveToEx (hDC,ptTick.x,ptTick.y + Offset, NULL);
                LineTo (hDC,ptTick.x,ptTick.y + Offset + Length);
            }
        }
        else
        {
            for (i=lpInfo->Min; i<=lpInfo->Max; i+=lpInfo->BigTickInc)
            {
                Slider_PointFromValue (hWindow,i,&ptTick,lpInfo);
                MoveToEx (hDC,ptTick.x + Offset,ptTick.y, NULL);
                LineTo (hDC,ptTick.x + Offset + Length,ptTick.y);
            }
        }
    }
    Length /= 2;
    if (lpInfo->SmallTickInc)
    {
        if (lpInfo->lStyle & SS_HORZSLIDER)
        {
            for (i=lpInfo->Min; i<=lpInfo->Max; i+=lpInfo->SmallTickInc)
            {
                Slider_PointFromValue (hWindow,i,&ptTick,lpInfo);
                MoveToEx (hDC,ptTick.x,ptTick.y + Offset, NULL);
                LineTo (hDC,ptTick.x,ptTick.y + Offset + Length);
            }
        }
        else
        {
            for (i=lpInfo->Min; i<=lpInfo->Max; i+=lpInfo->SmallTickInc)
            {
                Slider_PointFromValue (hWindow,i,&ptTick,lpInfo);
                MoveToEx (hDC,ptTick.x + Offset,ptTick.y, NULL);
                LineTo (hDC,ptTick.x + Offset + Length,ptTick.y);
            }
        }
    }
    SelectObject (hDC,hOldPen);
    DeleteObject (hPen);
}