Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CTreeView scrollbar

CTreeView scrollbar

Scheduled Pinned Locked Moved C / C++ / MFC
questiondata-structures
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    I have an MDI, as explorer style ... as left view I have an CTreeView, and on PreCreateWindow handler I have following code:

    BOOL CMyTree::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Add your specialized code here and/or call the base class

    cs.style |= TVS\_HASLINES | TVS\_LINESATROOT | TVS\_HASBUTTONS | TVS\_CHECKBOXES;
    
    return CTreeView::PreCreateWindow(cs);
    

    }

    everything is OK, except I have an horizontal scrollbar, though I have few shorts items:

    HTREEITEM hItem = NULL;
    CTreeCtrl& Tree = GetTreeCtrl();
    
    Tree.DeleteAllItems();
    
    Tree.RedrawWindow();
    
    HTREEITEM hRoot = Tree.InsertItem(\_T("Root"));
    hItem = Tree.InsertItem(\_T("Item 1"), hRoot);
    hItem = Tree.InsertItem(\_T("Item 2"), hRoot);
    Tree.Expand(hRoot, TVE\_EXPAND);
    

    How can I get rid of horizontal scrollbar ? Thank you. P.S. I don't want to add TVS_SHOWSELALWAYS style to tree view.

    _ 1 Reply Last reply
    0
    • _ _Flaviu

      I have an MDI, as explorer style ... as left view I have an CTreeView, and on PreCreateWindow handler I have following code:

      BOOL CMyTree::PreCreateWindow(CREATESTRUCT& cs)
      {
      // TODO: Add your specialized code here and/or call the base class

      cs.style |= TVS\_HASLINES | TVS\_LINESATROOT | TVS\_HASBUTTONS | TVS\_CHECKBOXES;
      
      return CTreeView::PreCreateWindow(cs);
      

      }

      everything is OK, except I have an horizontal scrollbar, though I have few shorts items:

      HTREEITEM hItem = NULL;
      CTreeCtrl& Tree = GetTreeCtrl();
      
      Tree.DeleteAllItems();
      
      Tree.RedrawWindow();
      
      HTREEITEM hRoot = Tree.InsertItem(\_T("Root"));
      hItem = Tree.InsertItem(\_T("Item 1"), hRoot);
      hItem = Tree.InsertItem(\_T("Item 2"), hRoot);
      Tree.Expand(hRoot, TVE\_EXPAND);
      

      How can I get rid of horizontal scrollbar ? Thank you. P.S. I don't want to add TVS_SHOWSELALWAYS style to tree view.

      _ Offline
      _ Offline
      _Flaviu
      wrote on last edited by
      #2

      I had solved:

      cs.style |= TVS\_HASLINES | TVS\_LINESATROOT | TVS\_HASBUTTONS | TVS\_CHECKBOXES | TVS\_NOSCROLL;
      

      in case that anyone need it ...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups