120楼#
发布于:2002-11-14 20:28
else
{ if (pTheSkin->IsGraphicDefined(giTrackbarLRChannel) && pTheSkin->IsGraphicDefined(giTrackbarLRSliderBasic)) return new CCMTrackbar; } } return NULL; } const GraphicItemEnum CCMTrackbar::GetThumbGIE(const DWORD dwStyle) { GraphicItemEnum item = _ISVERT(dwStyle) ? giTrackbarTB |
|
121楼#
发布于:2002-11-14 20:28
GraphicItemEnum item2; if (dwStyle & TBS_LEFT) { // left or top. item2= _ISVERT(dwStyle) ? giTrackbarTBSliderLeftPoint : giTrackbarLRSliderTopPoint; } else { // right or bottom item2= _ISVERT(dwStyle) ? giTrackbarTBSliderRightPoint : giTrackbarLRSliderBottomPoint; } if (pTheSkin->IsGraphicDefined(item2)) item=item2; // use if defined; |
|
122楼#
发布于:2002-11-14 20:29
void CCMTrackbar::DrawControl(HDC hDC, const RECT& /*clientRect*/) { const DWORD dwStyle = GetStyle(); // easy stuff to deal with, icky style masks const bool hasTicks = ((dwStyle & TBS_NOTICKS)==0); // Note that for Vert styles, tic |
|
123楼#
发布于:2002-11-14 20:29
// and ticksOnBottom is for Right.
const bool ticksOnTop = ((dwStyle & (TBS_TOP|TBS_BOTH))!=0); const bool ticksOnBottom = ((dwStyle & TBS_BOTH)!=0) || ((dwStyle & TBS_TOP)==0); const int numTicks=SendMessage(m_hWnd,TBM_GETNUMTICS,0,0)-2; const GraphicItemEnum selGIitem = _ISVERT(dwStyle) ? giTrackbarTBChannelSelection : giTrackbarLRChannelSelection; RECT rc,thumbRect; SendMessage(m_hWnd, TBM_GETCHANNELRECT, 0, (LPARAM)&rc); if ((dwStyle & TBS_NOTHUMB)) { |
|
124楼#
发布于:2002-11-14 20:30
InflateRect(&rc,5,5); // offset the ticks this way. Don\'t worry about the
// intersecting pole; we only care about the line that works for us. This is // done so that the tick marks work properly. } else { SendMessage(m_hWnd, TBM_GETTHU |
|
125楼#
发布于:2002-11-14 20:30
if (memcmp(&thumbRect,&m_prevThumb,sizeof(RECT))!=0)
{ // Erase the little bits left over by our custom bitmap. HWND par=GetParent(m_hWnd); if (par!=NULL && !IsRectEmpty(&m_prevThumb)) { |
|
126楼#
发布于:2002-11-14 20:30
// Tell the parent window to erase it\'s background for us.
MapWindowPoints(m_hWnd,par,(LPPOINT)&m_prevThumb,2); // convert this rect to the erasing rect. // yes, it will be wrecked. and then reset. HDC pardc = GetDC(par); HRGN oldrgn=CreateRectRgnIndirect(&m_prevThumb); // scrap just to make a region int rc1=GetClipRgn(pardc,oldrgn); // had better be 1. HRGN cliprgn=CreateRectRgnIndirect(&m_prevThumb); // area to actually clip /* { m_prevThumb=thumbRect; m_prevThumb.right++; |
|
127楼#
发布于:2002-11-14 20:31
SendMessage(par,WM_ERASEBKGND,(WPARAM)pardc,0); // 1 is used to debug erasing
if (rc1<1) SelectClipRgn(pardc,NULL); else SelectClipRgn(pardc,oldrgn); DeleteObject(cliprgn); DeleteObject(oldrgn); |
|
128楼#
发布于:2002-11-14 20:31
ReleaseDC(par,pardc);
} m_prevThumb=thumbRect; } } if (hasTicks) |
|
129楼#
发布于:2002-11-14 20:31
{
// const COLORREF color=::GetSysColor(COLOR_HIGHLIGHT); POINT pt; // needed for moveto, but unused by us. if (_ISVERT(dwStyle)) { const int topY = rc.top+5; const int bottomY = rc.bottom-6; const int leftX=thumbRect.left-1; // this is where the ticks will fall. const int rightX=thumbRect |
|
130楼#
发布于:2002-11-14 20:32
// Draw the edge ticks (always shown)
if (ticksOnTop) // on left { ::MoveToEx(hDC,leftX,topY,&pt); ::LineTo(hDC,leftX-4,topY); ::MoveToEx(hDC,leftX,bottomY,&pt); ::LineTo(hDC,leftX-4,bottomY); } if (ticksOnBottom) // on right { ::MoveToEx(hDC,rightX,topY,&pt); |
|
131楼#
发布于:2002-11-14 20:32
only one !
|
|
|
132楼#
发布于:2002-11-14 20:34
const GraphicItemEnum CCMTrackbar::GetThumbGIE(const DWORD dwStyle) { GraphicItemEnum item = _ISVERT(dwStyle) ? giTrackbarTBSliderBasic : giTrackbarLRSliderBasic; if (!(dwStyle & TBS_BOTH)) { GraphicItemEnum item2; if (dwStyle & TBS_LEFT) { // left or top. item2= _ISVERT(dwStyle) ? giTrackbarTBSli |
|
133楼#
发布于:2002-11-14 20:34
item2= _ISVERT(dwStyle) ? giTrackbarTBSliderLeftPoint : giTrackbarLRSliderTopPoint;
} else { // right or bottom item2= _ISVERT(dwStyle) ? giTrackbarTBSliderRightPoint : giTrackbarLRSliderBottomPoint; } if (pTheSkin->IsGraphicDefined(item2)) item=item2; // use if defined; otherwise default to basic. } return item; } |
|
134楼#
发布于:2002-11-14 20:35
ckbar::DrawControl(HDC hDC, const RECT& /*clientRect*/)
{ const DWORD dwStyle = GetStyle(); // easy stuff to deal with, |
|
135楼#
发布于:2002-11-14 20:35
case TBM_SETSEL: |
|
136楼#
发布于:2002-11-14 20:37
DrawScrollBar( SB_VERT ); DrawScrollBar( SB_HORZ ); }// else if( message == WM_VSCROLL ) { // DrawScrollBar( SB_VERT ); //} else if( message == WM_HSCROLL ) { // DrawScrollBar( SB_HORZ ); //} return lrst; } |
|
137楼#
发布于:2002-11-14 20:37
void CMyListCtrl::OnNcLButtonDown(UINT nHitTest, CPoint point) { if( 0/*nHitTest == HTVSCROLL */) { /* int nPos = ScreenToScroll( point.y ); SCROLLINFO si = { sizeof( SCROLLINFO ) }; GetScrollInfo( SB_VERT, &si ); if( nPos >= si.nMin && nPos <= si.nMax ) { if( nPos != si.nPos ) { |
|
138楼#
发布于:2002-11-14 20:38
si.nPos = nPos;
si.fMask = SIF_POS; SetScrollInfo( SB_VERT, &si ); } } */ |
|
139楼#
发布于:2002-11-14 20:39
if (GetFocus() != this) SetFocus();
while( 1 ) { MSG msg; VERIFY(::GetMessage(&msg, NUL |
|