本文整理汇总了C++中GetScrollPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ GetScrollPosition函数的具体用法?C++ GetScrollPosition怎么用?C++ GetScrollPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetScrollPosition函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetScrollPosition
afx_msg void
MFCArrangeView::OnMButtonUp(
UINT nFlags,
CPoint point
)
{
point += GetScrollPosition();
}
开发者ID:dakyri,项目名称:qua,代码行数:8,代码来源:MFCArrangeView.cpp
示例17: NextItem
//Imago #133 7/10
void NextItem()
{
if (GetSelItemIdx() < m_vItems.GetCount() - 1) {
SetSelItemByIdx(GetSelItemIdx()+1);
if ((GetScrollPosition() + m_cVisibleItems) <= GetSelItemIdx())
ScrollPageDown();
}
}
开发者ID:kgersen,项目名称:Allegiance,代码行数:9,代码来源:trekctrls.cpp
示例18: GetDocument
void CImconView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CImconDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (m_bScaleToWindow)
return;
m_ptScrollOffset = GetScrollPosition();
if (m_bSelection)
DrawSelectionRect(&m_rectSelection); // Delete old selection
m_bSelection = FALSE;
m_ptStartPosition.x = point.x;
m_ptStartPosition.y = point.y;
m_rectSelection.left = m_ptStartPosition.x;
m_rectSelection.top = m_ptStartPosition.y;
m_rectSelection.right = point.x;
m_rectSelection.bottom = point.y;
m_rectSelection += m_ptScrollOffset;
if (m_rectSelection.left >= (int) pDoc->m_uWidth)
{
m_rectSelection.left = 0;
m_rectSelection.right = 0;
m_ptStartPosition.x = pDoc->m_uWidth - 1;
}
if (m_rectSelection.top >= (int) pDoc->m_uHeight)
{
m_rectSelection.top = 0;
m_rectSelection.bottom = 0;
m_ptStartPosition.y = pDoc->m_uHeight - 1;
}
m_rectSelection.NormalizeRect();
CString strSelectionText;
CPoint pixel;
BYTE cGray;
pixel.x = point.x + m_ptScrollOffset.x;
pixel.y = ((int) pDoc->m_uHeight - 1) - (point.y + m_ptScrollOffset.y);
if ((pixel.x >= (int) pDoc->m_uWidth) || ( (pixel.y >= (int) pDoc->m_uHeight) && (pixel.y >= 0) ) )
{
strSelectionText.Format("");
}
else
{
cGray = pDoc->m_Dib.GetPixelValue(pixel);
strSelectionText.Format("Pixel (x,y): %d,%d mit Wert %d", pixel.x, pixel.y, cGray);
}
((CMainFrame *) AfxGetMainWnd())->SetSelectionText((LPCSTR) strSelectionText);
m_bSelectionStarted = TRUE;
CScrollView::OnLButtonDown(nFlags, point);
}
开发者ID:geha,项目名称:Medizinische-Bildanalyse,代码行数:58,代码来源:ImconView.cpp
示例19: GetScrollPosition
void wxJigsawEditorCanvas::FixViewOffset()
{
if(m_View)
{
wxPoint pt = GetScrollPosition();
wxSize offset(-pt.x, -pt.y);
m_View->SetViewOffset(offset);
}
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:9,代码来源:wxJigsawEditorCanvas.cpp
示例20: GetScrollPosition
void CSpermView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMainFrame* pMainFrm=(CMainFrame*)AfxGetMainWnd();
CView3* pView=(CView3*)pMainFrm->GetView3();
CMorphaDetectDLG* pWnd=(CMorphaDetectDLG*)pView->m_pwndMorphaDetDlg;
if(pWnd==NULL || pWnd->m_hWnd == NULL) return;
vector<SpermImage>& m_vRSpermImage = pWnd->m_vRSpermImage;
vector<SpermImage>& m_vOSpermImage = pWnd->m_vOSpermImage;
vector<SperMopyParameter>&m_vSperMopyParameter = pWnd->m_vSperMopyParameter;
vector<SpermRegion>&m_vSpermRegion = pWnd->m_vSpermRegion ;
vector<IsSperNormal>&m_vbIsNormal = pWnd->m_vbIsNormal;
int i, iPos = -1, n;
n = m_vRSpermImage.size();
CPoint sp = GetScrollPosition(); // 得到视图滚动了多少(以象素为单位)
point += sp;
double d, min = 1<<20;
CPoint p;
for(i=0; i<n; i++)
{
if( m_vSpermRegion[i].isDeleted == TRUE ) continue;
p = CPoint(m_vSpermRegion[i].SpermCenterPos.y, m_vSpermRegion[i].SpermCenterPos.x);
if( IsInRect(point, pWnd->m_nR, p) )
{
d = dist(point, p);
if(d<min)
{
min = d;
iPos = i;
}
}
}
pWnd->m_nSelNO = iPos;
m_nPos = iPos;
if(m_nPos == -1 ) return;
CRect rc;
GetClientRect(rc);
CDC* pDC=GetDC();
rc.bottom+=sp.y;
rc.right+=sp.x;
pDC->SetViewportOrg(-sp);
DrawMemDCImage(pDC,rc);
ReleaseDC(pDC);
pWnd->UpdateData(FALSE);
pWnd->Invalidate();
CScrollView::OnLButtonDown(nFlags, point);
}
开发者ID:niepp,项目名称:sperm-x,代码行数:57,代码来源:SpermView.cpp
注:本文中的GetScrollPosition函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论