コード例 #1
0
ファイル: SkinMgr.cpp プロジェクト: 3rdexp/jezzitest
HRESULT WINAPI InstallSkinScrollBar(HWND hWnd)
{
	BOOL f = InitializeCoolSB(hWnd);
	ATLASSERT( f );
	if( f )
	{
		RECT rc;
		BOOL fScroll = FALSE;
		CComPtr<ISkinScheme> pss;
		GetCurrentScheme(&pss);

		if ( pss )
			fScroll = pss->GetRect(SCROLLBAR, SBP_ARROWBTN, 1, &rc);

		int nWidth = 0 ;
		int nHeight = 0;

		if ( fScroll )
		{
			nWidth = rc.right - rc.left;
			nHeight = rc.bottom - rc.top;
		}

		f = CoolSB_SetStyle(hWnd, SB_BOTH, CSBS_NORMAL);
		ATLASSERT( f );
		f = CoolSB_SetSize(hWnd, SB_BOTH, nWidth > 0 ? nWidth : 15, nHeight > 0 ? nHeight : 15);
		ATLASSERT( f );
		f = CoolSB_SetMinThumbSize(hWnd, SB_BOTH, nWidth);
		ATLASSERT( f );
		return S_OK;
	}
	return S_FALSE;
}
コード例 #2
0
ファイル: coolsb_test.c プロジェクト: jsleroy/CoolSB
//
//	Main window procedure
//
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	int width, height;
	NMHDR *hdr = (NMHDR *)lParam;
	SCROLLINFO si;

	switch(msg)
	{
	case WM_CREATE:

		hwndCtrl   = CreateWindowEx(WS_EX_CLIENTEDGE,
			szChildClass, "Test", 
			WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL,
			0,0,0,0, hwnd, 0, GetModuleHandle(0), 0);

		InitializeCoolSB(hwndCtrl);
		CoolSB_SetStyle(hwndCtrl, SB_BOTH, CSBS_NORMAL);

		si.cbSize = sizeof(si);
		si.fMask  = SIF_ALL;
		si.nMin   = 0;
		si.nMax   = 100;
		si.nPos   = 0;
		si.nPage  = 10;

		SetScrollInfo(hwndCtrl, SB_VERT, &si, TRUE);

		return 0;

	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;

	case WM_CLOSE:
		DestroyWindow(hwnd);
		return 0;

	case WM_SIZE:
		width  = (short)LOWORD(lParam);
		height = (short)HIWORD(lParam);

		MoveWindow(hwndCtrl, 0, 0, width, height, TRUE);
		return 0;

	case WM_COMMAND:
		return CommandHandler(hwnd, wParam, lParam);

	case WM_NOTIFY:
		if(hdr->code == NM_COOLSB_CUSTOMDRAW)
		{
			return HandleCustomDraw(wParam, (NMCSBCUSTOMDRAW *)lParam);
		}
		break;

	}
	return DefWindowProc(hwnd, msg, wParam, lParam);
}
コード例 #3
0
ファイル: MyListCtrl.cpp プロジェクト: 2Dou/PlayBox
void CMyListCtrl::OnPaint()
{
	if(!m_bInit )
	{
		int w,h;
		w = h = 15;

		if( m_pBitmapScrollHorz && m_pBitmapScrollVert )
		{
			h = m_pBitmapScrollVert->GetHeight() / 3;
			w = m_pBitmapScrollVert->GetWidth() / 6;
		}

		InitializeCoolSB(m_hWnd);
		CoolSB_SetStyle(m_hWnd, SB_BOTH, CSBS_HOTTRACKED);
		CoolSB_SetSize(m_hWnd, SB_BOTH, h, w);
		::CoolSB_SetMinThumbSize(m_hWnd, SB_BOTH, 8);
		m_bInit = true;
	}

    CRect rectClient;
	GetClientRect(rectClient);
	CRect rectClip;
	GetUpdateRect(rectClip,FALSE);
	if( rectClip.right < rectClient.right )
	{
		rectClip.right = rectClient.right;
	}

	int width = 0;
	for(int i = 0 ; i<m_mapColumnInfo.size(); i++)
		width += GetColumnWidth(i);

	if(rectClip.left >= width)
		rectClip.left = width -1;

	InvalidateRect( rectClip );

	__super::OnPaint();
}