这篇教程C++ GetScrollPosition函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetScrollPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ GetScrollPosition函数的具体用法?C++ GetScrollPosition怎么用?C++ GetScrollPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetScrollPosition函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例2: SetCapturevoid 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,
示例3: GetScrollPositionvoid 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,
示例4: GetClientRectBOOL 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,
示例5: GetClientRectvoid 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,
示例6: GetScrollPositionvoid 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,
示例7: GetDocumentvoid 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,
示例8: GetDocumentvoid 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,
示例9: GetClientRectvoid 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,
示例10: ScreenToClientvoid 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,
示例11: GetParentFramevoid 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,
|