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


C++ GetScrollPosition函数代码示例

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


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

示例1: GetScrollPosition

		/*=============================================================================
		-- Updates the ScrollBar.
		=============================================================================*/
		void ScrollBar::_Update()
		{
			double oldScrollPosition = GetScrollPosition();

			//update the scroll position
			int knobLength = (mSpanDirection == SpanDirection::HORIZONTAL) ? mKnobButton.lock()->GetWidth() : mKnobButton.lock()->GetHeight();
			int knobMin = SCROLL_BAR_BUTTON_SIZE;
			int knobMax = ((mSpanDirection == SpanDirection::HORIZONTAL) ? GetWidth() : GetHeight()) - SCROLL_BAR_BUTTON_SIZE - knobLength;
			int innerRange = knobMax - knobMin;

			Vector2D<int> knobRelPos = mKnobButton.lock()->GetRelPos();
			int knobOffset = ((mSpanDirection == SpanDirection::HORIZONTAL) ? knobRelPos.x : knobRelPos.y) - SCROLL_BAR_BUTTON_SIZE;

			mScrollPosition = DivideD((double)knobOffset,(double)innerRange);

			//check if either increase/decrease button were pressed
			if (mAdjustTimer.GetTimeAndEnd() > SCROLL_BAR_ADJUST_DELAY)
			{
				if (mButtonDecrease.lock()->GetState() == State::DOWN)
					SetScrollPosition(GetScrollPosition() + 0.01);
				else if (mButtonIncrease.lock()->GetState() == State::DOWN)
					SetScrollPosition(GetScrollPosition() - 0.01);

				mAdjustTimer.Start();
			}

			if (GetScrollPosition() != oldScrollPosition)
				_SendElementMessageToListeners(ElementEvent::VALUE_CHANGED);
		}
开发者ID:DanWatkins,项目名称:GlanceEngineSDK,代码行数:32,代码来源:ScrollBar.cpp

示例2: SetCapture

void CMapView::OnLButtonDown(UINT nFlags, CPoint point)
{
    if (m_HandDown)
    {
        m_Tracking = true;
        SetCapture();
        m_LastPoint = point;
    }
    else
    {
        CPoint pt = point + GetScrollPosition();

        int x  = pt.x / 40;
        int y  = pt.y / 40;
        int xe = (pt.x % 40) / 10;
        int ye = (pt.y % 40) / 10;

        CMapDoc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        int w = pDoc->GetWidth();
        int h = pDoc->GetHeight();

        if (w > 0 && h > 0 && x >= 0 && y >= 0 && x < w && y < h && xe >= 0 && xe < 4 && ye >= 0 && ye < 4)
        {
            int r = y*w + x;
            int e = ye*4 + xe;

            if (m_ViewMode == VIEW_MODE_ELEVATION)
            {
                pDoc->SetTileElevation(r, g_Elevation);
                CString str;
                str.Format("Change %d to %dm", r, g_Elevation);
                g_App.PrintStatus(str);

                CRect rect(CPoint(x*40, y*40), CSize(40,40));
                rect.OffsetRect(-GetScrollPosition());
                InvalidateRect(rect, FALSE);
            }
            else
            {
                pDoc->SetTile(r,e, g_Tile);
                CString str;
                str.Format("Change %d [%d] to %s", r,e, g_App.m_Elements[g_Tile].Name);
                g_App.PrintStatus(str);

                CRect rect(CPoint(x*40 + xe*10, y*40 + ye*10), CSize(10,10));
                rect.OffsetRect(-GetScrollPosition());
                InvalidateRect(rect, FALSE);
            }

            m_Tracking = true;
            SetCapture();
        }
    }

    Inherited::OnLButtonDown(nFlags, point);
}
开发者ID:gshaw,项目名称:closecombat,代码行数:57,代码来源:MapView.cpp

示例3: GetScrollPosition

void DisplayView::OnLButtonUp(UINT nFlags, CPoint point)
{
    point += GetScrollPosition();

    // check for an overlay icon
    if (drag_mode == DisplayView::DRAG_OVERLAY_ICON) {
        Filter	*current = graph.FindFilterByPos(point);
        if (current && current == overlay_filter) {
            int icon = current->CheckIcons(point);
            if (icon >= 0) {
                OnOverlayIconClick(current->overlay_icons[icon], point);
            }
        }
    }

    if (drag_mode == DisplayView::DRAG_CONNECTION) {
        Pin *p1 = graph.FindPinByPos(new_connection_start);
        Pin *p2 = graph.FindPinByPos(new_connection_end);

        int ret = graph.ConnectPins(p1, p2);
        if (ret < 0) {
            // TODO: error message
        }
    }
    new_connection_start = CPoint(-100,-100);
    new_connection_end = CPoint(-101, -101);
    drag_mode = DisplayView::DRAG_GROUP;
    ReleaseCapture();
    graph.Dirty();
    Invalidate();
}
开发者ID:CyberShadow,项目名称:graphstudio,代码行数:31,代码来源:display_view.cpp

示例4: GetClientRect

BOOL CSpermView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
{
	// TODO: Add your message handler code here and/or call default

	CSize sz1=GetTotalSize();
	CRect rect;
	GetClientRect(rect);
	CSize sz2(rect.Width(),rect.Height());
	if(sz1.cy<sz2.cy)
		return CScrollView::OnMouseWheel(nFlags, zDelta, pt);;
	SCROLLINFO si;
	zDelta =  -zDelta;
	GetScrollInfo(SB_VERT,&si);
	si.nPos += zDelta/12;
	SetScrollInfo(SB_VERT,&si);


	CPoint sp=GetScrollPosition();
	CRect rc;
	GetClientRect(rc);
	CDC* pDC=GetDC();
	rc.bottom+=sp.y;
	rc.right+=sp.x;
	pDC->SetViewportOrg(-sp);
	DrawMemDCImage(pDC,rc);
	ReleaseDC(pDC);
	return CScrollView::OnMouseWheel(nFlags, zDelta, pt);
}
开发者ID:niepp,项目名称:sperm-x,代码行数:28,代码来源:SpermView.cpp

示例5: GetClientRect

void CResizableFormView::GetTotalClientRect(LPRECT lpRect)
{
	GetClientRect(lpRect);

	// get dialog template's size
	// (this is set in CFormView::Create)
	CSize size = GetTotalSize();

	// before initialization use dialog's size
	if (!m_bInitDone)
	{
		lpRect->right = lpRect->left + size.cx;
		lpRect->bottom = lpRect->top + size.cy;
		return;
	}

	// otherwise, give the correct size if scrollbars active

	if (m_nMapMode < 0)	// scrollbars disabled
		return;

	// enlarge reported client area when needed
	CRect rect(lpRect);
	if (rect.Width() < size.cx)
		rect.right = rect.left + size.cx;
	if (rect.Height() < size.cy)
		rect.bottom = rect.top + size.cy;

	rect.OffsetRect(-GetScrollPosition());
	*lpRect = rect;
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:31,代码来源:ResizableFormView.cpp

示例6: GetScrollPosition

void CMapView::OnRButtonDown(UINT, CPoint point)
{
    CPoint pt = point + GetScrollPosition();

    int x  = pt.x / 40;
    int y  = pt.y / 40;
    int xe = (pt.x % 40) / 10;
    int ye = (pt.y % 40) / 10;

    CMapDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    int w = pDoc->GetWidth();
    int h = pDoc->GetHeight();

    if (w > 0 && h > 0 && x >= 0 && y >= 0 && x < w && y < h && xe >= 0 && xe < 4 && ye >= 0 && ye < 4)
    {
        int r = y*w + x;
        int e = ye*4 + xe;

        CTile Tile = pDoc->GetTile(r);
        g_Tile = Tile.E[e];
        g_Elevation = Tile.Elevation;

        CString str;
        str.Format("Select %s (%dm) from %d [%d]", g_App.m_Elements[g_Tile].Name, g_Elevation, r,e);
        g_App.PrintStatus(str);
    }
}
开发者ID:gshaw,项目名称:closecombat,代码行数:28,代码来源:MapView.cpp

示例7: GetDocument

void CUIDesignerView::OnDraw(CDC* pDrawDC)
{
	CUIDesignerDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: 在此处为本机数据添加绘制代码
	CMemDC memDC(*pDrawDC, this);
	CDC* pDC = &memDC.GetDC();

	CRect rectClient;
	GetClientRect(rectClient);
	CPoint point=GetScrollPosition();
	rectClient.OffsetRect(point);
	pDC->FillSolidRect(rectClient,RGB(255, 255, 255));

	CSize szFormSize=m_LayoutManager.GetForm()->GetInitSize();
	CSize szFormOffset(FORM_OFFSET_X,FORM_OFFSET_Y);
	CDC hCloneDC;
	HBITMAP hNewBitmap;
	hCloneDC.CreateCompatibleDC(pDC);
	hNewBitmap=::CreateCompatibleBitmap(pDC->GetSafeHdc(),szFormSize.cx,szFormSize.cy);
	HBITMAP hOldBitmap=(HBITMAP)hCloneDC.SelectObject(hNewBitmap);
	m_LayoutManager.Draw(&hCloneDC);
	pDC->BitBlt(szFormOffset.cx,szFormOffset.cy,szFormSize.cx,szFormSize.cy,&hCloneDC,0,0,SRCCOPY);
	hCloneDC.SelectObject(hOldBitmap);
	::DeleteDC(hCloneDC);
	::DeleteObject(hNewBitmap);

	m_MultiTracker.Draw(pDC,&szFormOffset);
}
开发者ID:pyq881120,项目名称:urltraveler,代码行数:32,代码来源:UIDesignerView.cpp

示例8: GetDocument

void CWFView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	CBTEditDoc* pDoc = GetDocument();
	CHeightMap *HeightMap = pDoc->GetHeightMap();
	RECT WindowRect;

	CPoint SPos = GetScrollPosition();

	// Make click point relative to window top left.
	GetWindowRect(&WindowRect);
	int ObjID = HeightMap->FindObjectHit2D(SPos.x,SPos.y,
											point.x-WindowRect.left,
											point.y-WindowRect.top);

	// If found an object then
   	if(ObjID >= 0) {
		// Select it
		HeightMap->DeSelectAll3DObjects();
   		HeightMap->Select3DObject(ObjID);
   		pDoc->Invalidate3D();
		UpdateAndValidate();

		// And bring up it's context menu.
   		CMenu Menu;
   		Menu.LoadMenu(IDR_2DPOPUP);
   		Menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
   							point.x,point.y,this);
   		m_CurrentObjectID = ObjID;
   	}
}
开发者ID:cybersphinx,项目名称:wzgraphicsmods,代码行数:30,代码来源:wfview.cpp

示例9: GetClientRect

void CPrime95View::OnDraw(CDC* pDC)
{
	RECT	r;
	CPoint	scroll_offset;
	int	ypos;
	int	first_line, skip_lines, i, j;

	pDC->SetBkMode (TRANSPARENT);
	pDC->SetTextColor (GetSysColor (COLOR_WINDOWTEXT));

	GetClientRect (&r);
	scroll_offset = GetScrollPosition ();

/* If Lines[0] is empty, then output lines NumLines to 1 */
/* If Lines[0] has text, then output lines NumLines-1 to 0 */

	gwmutex_lock (&VIEW_LINES_MUTEX);
	first_line = Lines[0][0] ? NumLines - 1 : NumLines;
	skip_lines = (r.top + scroll_offset.y) / charHeight;
	if (skip_lines < NumLines) {
		i = first_line - skip_lines;
		j = NumLines - skip_lines;
		ypos = skip_lines * charHeight;
		for ( ; j; i--, j--) {
			pDC->TextOut (0, ypos, Lines[i], (int) strlen (Lines[i]));
			ypos += charHeight;
			if (ypos > r.bottom + scroll_offset.y) break;
		}
	}
	gwmutex_unlock (&VIEW_LINES_MUTEX);
}
开发者ID:irukasti,项目名称:mprime,代码行数:31,代码来源:Prime95View.cpp

示例10: ScreenToClient

void wxJigsawEditorCanvas::OnIdle( wxIdleEvent& event )
{	
	do
	{
		if(!HasCapture()) break;

		// get mouse in client coordinates
		wxPoint currentPos = ScreenToClient(wxGetMousePosition());

		//Update the offset to the next mouse down event
		if(m_View->GetSelectedObject())
		{
			wxPoint diagramPoint = PointToViewPoint(currentPos);
			wxPoint groupPosition = m_View->GetRealGroupPosition(m_View->GetSelectedObject());
			m_SelectedObjectOffset = wxSize(
				diagramPoint.x - groupPosition.x,
				diagramPoint.y - groupPosition.y);
		}

		// get scroll position
		wxPoint scrollPos = GetScrollPosition();
		

		// auto scroll
		// check current drag position and update scroll regularly
		if(AutoScroll(currentPos, scrollPos))
		{
			event.RequestMore();
		}
		FixViewOffset();
	}
	while(false);
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:33,代码来源:wxJigsawEditorCanvas.cpp

示例11: GetParentFrame

void CPrime95View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
	CFrameWnd *parent;
	CSize	sz;
	CPoint	pos;
	int	new_scroll_height, new_scroll_width;

	parent = GetParentFrame();

	if (parent != NULL) {

		if (charHeight == 0) getCharSize ();

		sz = GetTotalSize ();

		new_scroll_height = NumLines * charHeight;
		new_scroll_width = MaxLineSize * charWidth;

		pos = GetScrollPosition ();
		pos.y += (new_scroll_height - sz.cy);
		if (pos.y < 0) pos.y = 0;
		sz.cx = new_scroll_width;
		sz.cy = new_scroll_height;
		SetScrollSizes (MM_TEXT, sz);
		ScrollToPosition (pos);
		parent->RecalcLayout ();
	}

	CScrollView::OnUpdate (pSender, lHint, pHint);
}
开发者ID:irukasti,项目名称:mprime,代码行数:30,代码来源:Prime95View.cpp

示例12: GetDocument

void CLeftView::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: この位置にメッセージ ハンドラ用のコードを追加するかまたはデフォルトの処理を呼び出してください
	CVEDoc* pDoc = GetDocument();
	POSITION lpos;
	CClass* pCls;
	CModule* pMdl;
	
	pos = GetScrollPosition();
	pCls=(CClass*)pDoc->cls.GetAt(pDoc->cls.FindIndex(pDoc->ac));
	lpos=pCls->mdl.GetHeadPosition();
	while(lpos) {
		pMdl=(CModule*)pCls->mdl.GetNext(lpos);
		rt.m_rect = pMdl->rect;
		rt.m_rect.left -= pos.x;
		rt.m_rect.top -= pos.y;
		rt.m_rect.right -= pos.x;
		rt.m_rect.bottom -= pos.y;
		if (rt.HitTest(point)>=0) {
			OnProperties();
			pDoc->am=i;
//			InvalidateRect(NULL);
			return;
		}
	}
	pDoc->am=before_am;
	client_point=point;
	OnInsert();

	CScrollView::OnLButtonDblClk(nFlags, point);
}
开发者ID:Jester68k,项目名称:DP,代码行数:31,代码来源:LeftView.cpp

示例13: OnButtonRightarrow

void CSpermView::OnButtonRightarrow() 
{
	CMainFrame* pMainFrm=(CMainFrame*)AfxGetMainWnd();
	CView3* pView3= (CView3*)pMainFrm->GetView3();
	CMorphaDetectDLG*& pMorphaDlg=pView3->m_pwndMorphaDetDlg;

	list<int>& m_lsOperateIndex=pView3->m_pwndMorphaDetDlg->m_lsOperateIndex;
	list<int>::iterator& m_itListIndex=pView3->m_pwndMorphaDetDlg->m_itListIndex;
	pMorphaDlg->DeleteSperm(*m_itListIndex);
	++m_itListIndex;
	pMorphaDlg->FormResultImage();

	CString str;
	str.Format("目前一共检测了%d个视野,%d个精子,其中%d个正常,%d个异常.",
		pMorphaDlg->m_nVideoFiled,pMorphaDlg->m_MhNum.AbnormalSpermNum+pMorphaDlg->m_MhNum.NormalSpermNum,
		pMorphaDlg->m_MhNum.NormalSpermNum,pMorphaDlg->m_MhNum.AbnormalSpermNum);
	pMorphaDlg->GetDlgItem(IDC_DETECT_INFO)->SetWindowText(str);

	CPoint sp=GetScrollPosition();
	CRect rc;
	GetClientRect(rc);
	CDC* pDC=GetDC();
	rc.bottom+=sp.y;
	rc.right+=sp.x;
	pDC->SetViewportOrg(-sp);
	DrawMemDCImage(pDC,rc);
	ReleaseDC(pDC);
}
开发者ID:niepp,项目名称:sperm-x,代码行数:28,代码来源:SpermView.cpp

示例14: GetScrollPosition

afx_msg void
MFCSequenceEditor::OnRButtonUp(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
}
开发者ID:dakyri,项目名称:qua,代码行数:8,代码来源:MFCDataEditor.cpp

示例15: PreviousItem

    void PreviousItem()
    {
        if (GetSelItemIdx() != 0) {
			SetSelItemByIdx(GetSelItemIdx()-1);
			if (GetScrollPosition() > GetSelItemIdx())
				ScrollPageUp();
		}
    }
开发者ID:kgersen,项目名称:Allegiance,代码行数:8,代码来源:trekctrls.cpp


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