Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Scroll the horizontal scroll bar to the end

rksb_preethirksb_preethi Member Posts: 1
Hi..

[b]I have a horizontal scroll bar in my application which needs to scroll to the end if I press the keys Ctrl+E. Please help..[/b]

I have implemented another functionality, which is scrolling to the beginning using the keys Ctrl+T. It is as follows: (This code is working).

OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch( nChar )
{
case 'T':
if( ( ::GetKeyState ( VK_CONTROL ) & 0x80 ) == 0)
{

//Ctrl key is not pressed
}
else
{
//Ctrl key is pressed

SCROLLINFO ScrollInfo;
memset( &ScrollInfo, 0, sizeof(ScrollInfo) );
ScrollInfo.cbSize = sizeof(ScrollInfo);
ScrollInfo.nMin = 0;
ScrollInfo.nPos = m_CtrlScrollBar.GetScrollPos();
ScrollInfo.nPos = ScrollInfo.nMin;
m_CtrlScrollBar.SetScrollInfo( &ScrollInfo );
m_CtrlScrollBar.SetScrollPos(0,true);

if( ScrollInfo.nPos != (int)pDoc->m_dwTimeDiv )
{
int nCurrentPos = pDoc->m_dwTimeDiv;
pDoc->m_dwTimeDiv = 0;
pDoc->m_dwCursorTime = 0;
CRect rectInvalidate;
CRect rectGraph = m_rectGraph;
rectGraph.InflateRect( 0, 0, 1, 1 );
CSize sizeScroll( ( GV_GRAPH_PIXEL_DIV_X * ( nCurrentPos - pDoc->m_dwTimeDiv ) ), 0 );

}
break;
}
}
}

Thanks in advance..
Sign In or Register to comment.