当前位置: 首页>>代码示例>>C++>>正文


C++ GetScrollInfo函数代码示例

本文整理汇总了C++中GetScrollInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetScrollInfo函数的具体用法?C++ GetScrollInfo怎么用?C++ GetScrollInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetScrollInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetScrollInfo

void XYDrawbox::RefreshYPosScrollBar()
{
	scrollinfo.fMask = SIF_POS;
	scrollinfo.nPos = this->posYScroll;
	SetScrollInfo(this->hwndThis, SB_VERT, &scrollinfo, TRUE);
	GetScrollInfo(this->hwndThis, SB_VERT, &scrollinfo);
	this->posYScroll = scrollinfo.nPos;
}
开发者ID:adamadanandy,项目名称:XYDiaCap,代码行数:8,代码来源:xydrawbox.cpp

示例2: sizeof

 int NativeScrollBarWin::GetPosition() const
 {
     SCROLLINFO si;
     si.cbSize = sizeof(si);
     si.fMask = SIF_POS;
     GetScrollInfo(sb_container_->GetScrollBarHWND(), SB_CTL, &si);
     return si.nPos;
 }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:8,代码来源:native_scroll_bar_win.cpp

示例3: GetScrollInfo

LRESULT CTrashSkipCtrl::OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    SCROLLINFO si;
    int vertPos;

    si.cbSize = sizeof si;
    si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS;
    GetScrollInfo(SB_VERT, &si);

    vertPos = si.nPos;

    switch (LOWORD(wParam))
    {
    case SB_TOP:
        si.nPos = si.nMin;
        break;

    case SB_BOTTOM:
        si.nPos = si.nMax;
        break;

    case SB_LINEUP:
        si.nPos -= 1;
        break;

    case SB_LINEDOWN:
        si.nPos += 1;
        break;

    case SB_PAGEUP:
        si.nPos -= si.nPage;
        break;

    case SB_PAGEDOWN:
        si.nPos += si.nPage;
        break;

    case SB_THUMBTRACK:
        si.nPos = si.nTrackPos;
        break;

    default:
        break;
    }

    si.fMask = SIF_ALL;

    m_nPos = abs(si.nPos);
    SetScrollInfo(SB_VERT, &si, TRUE);
    int nScrollHeight = int((m_rcRealClient.Height() - m_rcClient.Height()) * (m_nPos * 1.0) / (m_rcRealClient.Height()));
    int n = (m_nHeight - nScrollHeight);
    if (n > 1 || n < -1)
    {
        Invalidate();
    }
    bHandled = FALSE;
    return TRUE;
}
开发者ID:6520874,项目名称:pcmanager,代码行数:58,代码来源:ktrashskipctrl.cpp

示例4: GetScrollInfo

void CTerrainEditorDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	SCROLLINFO si;
	si.cbSize=sizeof(si);
	GetScrollInfo(SB_HORZ,&si);
	int pos;
	switch(nSBCode)
	{
	case SB_LEFT:
		ScrollWindow(si.nPos-si.nMin,0);
		si.nPos=si.nMin;
		SetScrollInfo(SB_HORZ,&si);
		break;
	case SB_RIGHT:
		ScrollWindow(si.nPos-si.nMax+si.nPage,0);
		si.nPos=si.nMax-si.nPage;
		SetScrollInfo(SB_HORZ,&si);
		break;
	case SB_LINELEFT:
		pos=si.nPos;
		si.nPos-=10;
		if(si.nPos<si.nMin) si.nPos=si.nMin;
		ScrollWindow(pos-si.nPos,0);
		SetScrollInfo(SB_HORZ,&si);
		break;
	case SB_LINERIGHT:
		pos=si.nPos;
		si.nPos+=si.nPage;
		if(si.nPos>si.nMax-(int)si.nPage) si.nPos=si.nMax-si.nPage;
		ScrollWindow(pos-si.nPos,0);
		SetScrollInfo(SB_HORZ,&si);
		break;
	case SB_PAGELEFT:
		pos=si.nPos;
		si.nPos-=si.nPage;
		if(si.nPos<si.nMin) si.nPos=si.nMin;
		ScrollWindow(pos-si.nPos,0);
		SetScrollInfo(SB_HORZ,&si);
		break;
	case SB_PAGERIGHT:
		pos=si.nPos;
		si.nPos+=10;
		if(si.nPos>si.nMax-(int)si.nPage) si.nPos=si.nMax-si.nPage;
		ScrollWindow(pos-si.nPos,0);
		SetScrollInfo(SB_HORZ,&si);
		break;
	case SB_THUMBPOSITION:
	case SB_THUMBTRACK:
		ScrollWindow(si.nPos-nPos,0);
		si.nPos=nPos;
		SetScrollInfo(SB_HORZ,&si);
		break;
	default:
		break;
	}

	CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
}
开发者ID:phoenixzz,项目名称:SGPEngine,代码行数:58,代码来源:TerrainEditorDlg.cpp

示例5: sizeof

void CDisplayDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
    int h = 10;
    SCROLLINFO si;
    si.cbSize = sizeof(SCROLLINFO);
    si.fMask = SIF_ALL;
    GetScrollInfo(SB_VERT, &si);
    int nOldPos = si.nPos;

    switch (nSBCode)
    {
    case SB_LINEDOWN:
        si.nPos = min(si.nPos + h, si.nMax);
        break;
    case SB_PAGEDOWN:
        si.nPos = min(si.nPos + h * 10, si.nMax);
        break;
    case SB_LINEUP:
        si.nPos = max(si.nPos - h, si.nMin);
        break;
    case SB_PAGEUP:
        si.nPos = max(si.nPos - h * 10, si.nMin);
        break;
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        si.nPos = si.nTrackPos;
        break;
    case SB_TOP:
        si.nPos = si.nMin;
        break;
    case SB_BOTTOM:
        si.nPos = si.nMax;
        break;
    }

    SetScrollInfo(SB_VERT, &si);
    GetScrollInfo(SB_VERT, &si); //重新获取新的位置


    ScrollWindowEx(0, nOldPos - si.nPos,NULL, NULL, NULL, NULL, SW_ERASE|SW_SCROLLCHILDREN);
    UpdateWindow();
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);
    //m_ScreenDisplayer->ReflashDC();
    CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
开发者ID:luis-wang,项目名称:RemoteControlSystem,代码行数:45,代码来源:DisplayDlg.cpp

示例6: GetScrollPos

int GetScrollPos(HWND hwnd, int nBar)
{
	SCROLLINFO info;

	info.cbSize = sizeof(SCROLLINFO);
	info.fMask = SIF_POS;
	GetScrollInfo(g_sbTime, SB_CTL, &info);
	return info.nPos;
}
开发者ID:vincent0629,项目名称:GoodMedia,代码行数:9,代码来源:GoodPlayer.cpp

示例7: getScrollPos

static void getScrollPos(HWND hwnd, int *xpos, int *ypos)
{
	SCROLLINFO si;

	ZeroMemory(&si, sizeof (SCROLLINFO));
	si.cbSize = sizeof (SCROLLINFO);
	si.fMask = SIF_POS | SIF_TRACKPOS;
	if (GetScrollInfo(hwnd, SB_HORZ, &si) == 0)
		xpanic("error getting horizontal scroll position for Area", GetLastError());
	*xpos = si.nPos;
	// MSDN example code reinitializes this each time, so we'll do it too just to be safe
	ZeroMemory(&si, sizeof (SCROLLINFO));
	si.cbSize = sizeof (SCROLLINFO);
	si.fMask = SIF_POS | SIF_TRACKPOS;
	if (GetScrollInfo(hwnd, SB_VERT, &si) == 0)
		xpanic("error getting vertical scroll position for Area", GetLastError());
	*ypos = si.nPos;
}
开发者ID:AlexSteele,项目名称:ui,代码行数:18,代码来源:area_windows.c

示例8: sys_winlog_set

void sys_winlog_set( void *wnd, const char *txt ) {
	HWND text = (HWND)GetProp(wnd,PTEXT);
	DWORD a,b;
	SCROLLINFO sinf;
	POINT pt;
	sinf.cbSize = sizeof(sinf);
	sinf.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
	GetScrollInfo(text,SB_VERT,&sinf);
	SendMessage(text,EM_GETSCROLLPOS,0,(LPARAM)&pt);
	SendMessage(text,EM_GETSEL,(WPARAM)&a,(LPARAM)&b);
	SetWindowText(text,txt);
	SendMessage(text,EM_SETSEL,a,b);
	if( sinf.nPos + sinf.nPage == sinf.nMax || sinf.nMax == 1 ) {
		GetScrollInfo(text,SB_VERT,&sinf);
		pt.y = sinf.nMax - sinf.nPage;
	}
	SendMessage(text,EM_SETSCROLLPOS,0,(LPARAM)&pt);
}
开发者ID:exaphaser,项目名称:neko_static,代码行数:18,代码来源:sys_win.c

示例9: sizeof

int CGraphListCtrl::GetScrollPos32(int nBar, BOOL bGetTrackPos /* = FALSE */)
{
	SCROLLINFO si;
	si.cbSize = sizeof(SCROLLINFO);

	if (bGetTrackPos)
	{
		if (GetScrollInfo(nBar, &si, SIF_TRACKPOS))
			return si.nTrackPos;
	}
	else
	{
		if (GetScrollInfo(nBar, &si, SIF_POS))
			return si.nPos;
	}

	return 0;
}
开发者ID:kanbang,项目名称:SVN,代码行数:18,代码来源:GraphListCtrl.cpp

示例10: PrintText

void PrintText( HWND hwnd,int cxChar,int cyChar,int cxCaps )
{
	HDC hdc;
	PAINTSTRUCT ps;
	SCROLLINFO si;
	int iVertPos,iHorzPos,iPaintBeg,iPaintEnd;
	int x,y;
	TCHAR szBuffer[10];

	hdc = BeginPaint(hwnd,&ps);

	si.cbSize = sizeof(si);
	si.fMask = SIF_POS;
	GetScrollInfo(hwnd,SB_VERT,&si);
	iVertPos = si.nPos;

	GetScrollInfo(hwnd,SB_HORZ,&si);
	iHorzPos = si.nPos;

	iPaintBeg = max(0,iVertPos + ps.rcPaint.top / cyChar);
	iPaintEnd = min(NUMLINES - 1, iVertPos + ps.rcPaint.bottom / cyChar);

	for (int i = iPaintBeg ; i <= iPaintEnd ; i++)
	{
		x = cxChar * (1 - iHorzPos) ;
		y = cyChar * (i - iVertPos) ;

		TextOut (hdc, x, y,sysmetrics[i].szLabel,
			lstrlen (sysmetrics[i].szLabel)) ;

		TextOut (hdc, x + 22 * cxCaps, y,sysmetrics[i].szDesc,
			lstrlen (sysmetrics[i].szDesc)) ;

		SetTextAlign (hdc, TA_RIGHT | TA_TOP) ;

		TextOut (hdc, x + 22 * cxCaps + 40 * cxChar, y, szBuffer,
			wsprintf (szBuffer, TEXT ("%5d"),
			GetSystemMetrics (sysmetrics[i].iIndex))) ;

		SetTextAlign (hdc, TA_LEFT | TA_TOP) ;
	}

	EndPaint(hwnd,&ps);
}
开发者ID:yuechuanbingzhi163,项目名称:CPPPractice,代码行数:44,代码来源:DemoFunctions.cpp

示例11: sizeof

LRESULT CWindow::OnVScroll(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    SCROLLINFO si;

    si.cbSize = sizeof(si);
    si.fMask  = SIF_ALL;
    GetScrollInfo(hWnd, SB_VERT, &si);

    switch (LOWORD(wParam))
    {
    case SB_THUMBTRACK:
    case SB_THUMBPOSITION:
        si.nPos = HIWORD(wParam);
        break;

    case SB_PAGEDOWN:
        si.nPos += si.nPage;
        break;

    case SB_PAGEUP:
        si.nPos -= si.nPage;
        break;

    case SB_LINEUP:
        --si.nPos;
        break;

    case SB_LINEDOWN:
        ++si.nPos;
        break;
    }

    si.fMask = SIF_POS;
    SetScrollInfo(hWnd, SB_VERT, &si, True);
    GetScrollInfo(hWnd, SB_VERT, &si);
    if (iVScrollPos != si.nPos)
    {
        ScrollWindow(hWnd, 0, cyChar * (iVScrollPos - si.nPos), NULL, NULL);
        iVScrollPos = si.nPos;
        UpdateWindow(hWnd);
    }

    return ERROR_SUCCESS;
}
开发者ID:Emiyasviel,项目名称:Arianrhod,代码行数:44,代码来源:ED6AIViewer.cpp

示例12: scroll

static void scroll(uiArea *a, int which, struct scrollParams *p, WPARAM wParam, LPARAM lParam)
{
	int pos;
	SCROLLINFO si;

	pos = *(p->pos);
	switch (LOWORD(wParam)) {
	case SB_LEFT:			// also SB_TOP
		pos = 0;
		break;
	case SB_RIGHT:		// also SB_BOTTOM
		pos = p->length - p->pagesize;
		break;
	case SB_LINELEFT:		// also SB_LINEUP
		pos--;
		break;
	case SB_LINERIGHT:		// also SB_LINEDOWN
		pos++;
		break;
	case SB_PAGELEFT:		// also SB_PAGEUP
		pos -= p->pagesize;
		break;
	case SB_PAGERIGHT:	// also SB_PAGEDOWN
		pos += p->pagesize;
		break;
	case SB_THUMBPOSITION:
		ZeroMemory(&si, sizeof (SCROLLINFO));
		si.cbSize = sizeof (SCROLLINFO);
		si.fMask = SIF_POS;
		if (GetScrollInfo(a->hwnd, which, &si) == 0)
			logLastError(L"error getting thumb position for area");
		pos = si.nPos;
		break;
	case SB_THUMBTRACK:
		ZeroMemory(&si, sizeof (SCROLLINFO));
		si.cbSize = sizeof (SCROLLINFO);
		si.fMask = SIF_TRACKPOS;
		if (GetScrollInfo(a->hwnd, which, &si) == 0)
			logLastError(L"error getting thumb track position for area");
		pos = si.nTrackPos;
		break;
	}
	scrollto(a, which, p, pos);
}
开发者ID:Alcaro,项目名称:RetroArch,代码行数:44,代码来源:areascroll.cpp

示例13: GetScrollInfo

void BContainer::OnVScroll(UINT nSBCode,UINT nPos, CScrollBar* pScrollBar)
{
	// Handle vertical scrollbar messages
	// These can be tweaked to better fit the implementation
	int nInc;
	int yPos;
	SCROLLINFO si;


	GetScrollInfo(SB_VERT,&si,SIF_POS | SIF_RANGE | SIF_PAGE);
	yPos = si.nPos;
	nInc = 0;
	switch (nSBCode)
	{
	case SB_TOP: nInc = -si.nPos; break;
	case SB_BOTTOM: nInc = si.nMax-si.nPos; break;
	case SB_LINEUP: 
		if(si.nPos > 0)
			nInc = -1; 
		else 
			nInc = 0;
		break;
	case SB_LINEDOWN:
		if(si.nPage+si.nPos < si.nMax+1)
			nInc = 1; 
		else
			nInc = 0;
		break;
//	case SB_PAGEUP: nInc = min(-1, -m_nVertInc); break;
//	case SB_PAGEDOWN: nInc = max(1, m_nVertInc); break;
	case SB_THUMBTRACK: nInc = nPos - si.nPos; break;
	default: nInc = 0;
	}

//	nInc = max(-si.nPos, min(nInc, si.nMax - si.nPos));

	if (nInc)
	{
		si.nPos += nInc;
		int iMove = (yPos - si.nPos)*(ELEMENT_HEIGHT+ELEMENT_SIZE_BETWEEN);

		si.cbSize = sizeof(SCROLLINFO);
		si.fMask = SIF_POS ;
		SetScrollInfo(SB_VERT,&si,true);

		ScrollWindow(0, iMove, NULL, NULL);
	//	CWnd::UpdateWindow();
		//SetScrollPos(SB_VERT, m_nVscrollPos, TRUE);
		
	}
	

	
	CWnd::OnVScroll(nSBCode, nPos, pScrollBar);

}
开发者ID:berendeanicolae,项目名称:gml,代码行数:56,代码来源:BContainer.cpp

示例14: scroller

static int
scroller( HWND hwndDlg, WPARAM scroll_command )
{
  libspectrum_word base;
  SCROLLINFO si;

  si.cbSize = sizeof(si); 
  si.fMask = SIF_POS; 
  GetScrollInfo( GetDlgItem( hwndDlg, IDC_MEM_SB ), SB_CTL, &si );

  int value = si.nPos;
  
  /* in Windows we have to read the command and scroll the scrollbar manually */
  switch( LOWORD( scroll_command ) ) {
    case SB_BOTTOM:
      value = memorysb_max;
      break;
    case SB_TOP:
      value = memorysb_min;
      break;
    case SB_LINEDOWN:
      value += memorysb_step;
      break;
    case SB_LINEUP:
      value -= memorysb_step;
      break;
    case SB_PAGEUP:
      value -= memorysb_page_inc;
      break;
    case SB_PAGEDOWN:
      value += memorysb_page_inc;
      break;
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
      value = HIWORD( scroll_command );
      break;
    default:
      return 1;
  }
  if( value > memorysb_max ) value = memorysb_max;
  if( value < memorysb_min ) value = memorysb_min;

  /* Drop the low bits before displaying anything */
  base = value; base &= 0xfff0;

  /* set the new scrollbar position */
  memset( &si, 0, sizeof(si) );
  si.cbSize = sizeof(si); 
  si.fMask = SIF_POS; 
  si.nPos = base;
  SetScrollInfo( GetDlgItem( hwndDlg, IDC_MEM_SB ), SB_CTL, &si, TRUE );
  
  update_display( hwndDlg, base );
  
  return 0;
}
开发者ID:CiaranG,项目名称:ZXdroid,代码行数:56,代码来源:memorybrowser.c

示例15: GetScrollInfo

AutoScroller::~AutoScroller()
{
    if(scrollInfo_.fMask == 0)
    {
        scrollInfo_.fMask = SIF_ALL;
        BOOL res = GetScrollInfo(window_->GetHWND(), winSB(orient_), &scrollInfo_);
        if(!res)
            return;
    }
    bool autoScroll = scrollInfo_.nPos + static_cast<int>(scrollInfo_.nPage) >= scrollInfo_.nMax;
    if(autoScroll)
    {
        memset(&scrollInfo_, 0, sizeof(scrollInfo_));
        scrollInfo_.cbSize = sizeof(scrollInfo_);
        scrollInfo_.fMask = SIF_ALL;
        BOOST_VERIFY(GetScrollInfo(window_->GetHWND(), winSB(orient_), &scrollInfo_));
        window_->ScrollLines(scrollInfo_.nMax);
    }
}
开发者ID:go4and,项目名称:lib,代码行数:19,代码来源:WindowUtils.cpp


注:本文中的GetScrollInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。