Click here to Skip to main content
6,917,296 members and growing! (14,326 online)
Email Password   helpLost your password?
Desktop Development » Miscellaneous » General     Intermediate

A pager control wrapper class

By Kirk Stowell

This article presents a wrapper class for the pager control
VC6, MFC, Dev
Posted:15 Dec 1999
Views:40,768
Bookmarked:15 times
printPrint Friendly   add Share
      Discuss Discuss   Broken Article?Report  
9 votes for this article.
Popularity: 4.37 Rating: 4.58 out of 5

1

2

3

4
4 votes, 100.0%
5
  • Download demo project - 22 Kb
  • Download source files - 5 Kb
  • Sample Image - controls_pager.gif

    The class CCJPagerCtrl is fairly simple to use. It can be used in either a dialog or view. For demo purposes, I implemented it in a dialog using a CToolBar, but you can use any control or view class as the child window. Open your dialog in your resource editor and add a custom control. Modify the properties of the control as shown below:

    Sample Image

    In the OnInitDialog() section, add the following code:

    // TODO: Add extra initialization here
    
    if( !m_wndToolBar.Create(&m_Pager) ||
    	!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    	{
    		TRACE0("Failed to create toolbar\n");
    		return -1;      // fail to create
    
    	}
    	
    	// Make the toolbar flat.
    
    	m_wndToolBar.ModifyStyle(0, 0x0800);
    	
    	// Set the child HWND.
    
    	m_Pager.SetChild(m_wndToolBar.m_hWnd);
    	
    	// Set the pager style to PGS_HORZ.
    
    	m_Pager.ModifyStyle(0,PGS_HORZ);
    	
    	// Set the button size to 15.
    
    	m_Pager.SetButtonSize(15);
    	
    	// Determine size of child
    
    	SIZE Size;
    	m_wndToolBar.SendMessage(TB_GETMAXSIZE,0,(LPARAM)&Size);
    	
    	// Set the scroll area for pager.
    
    	m_Pager.SetScrollArea(Size.cx+15, Size.cy+15);
    

    NOTE:

    If you are using Visual C++ 5, you will need to include the support file comm_control.h in your project, unless you have installed the SDK, in which case you won't need this. If you have any questions, feel free to drop me a line.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    Kirk Stowell


    Member

    Occupation: CEO
    Company: Codejock Software
    Location: United States United States

    Other popular Miscellaneous articles:

    Article Top
    You must Sign In to use this message board.
    FAQ FAQ 
     
    Noise Tolerance  Layout  Per page   
     Msgs 1 to 2 of 2 (Total in Forum: 2) (Refresh)FirstPrevNext
    GeneralRe: Thanks Pinmembermla1549:00 2 Oct '06  
    Generalc# version Pinmembermatute2210:31 28 Feb '04  

    General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.

    PermaLink | Privacy | Terms of Use
    Last Updated: 15 Dec 1999
    Editor: Chris Maunder
    Copyright 1999 by Kirk Stowell
    Everything else Copyright © CodeProject, 1999-2010
    Web19 | Advertise on the Code Project