0

I created an application with the MFC wizard and added the splitter functionality.

The wizard will add a variable CSplitterWndEx m_wndSplitter to class CChildFrame.

After that, a split view will be created with a horizontal scrollbar and a vertical scrollbar.

But the rich edit view also has its own scroll bar.

How can I keep only one scrollbar and keep the split functionality?

Thanks in advance.

harriyott
  • 10,505
  • 10
  • 64
  • 103
  • Why do you say "After that, a split view will be created with a horizontal scrollbar and a vertical scrollbar"? You will only get scrollbars if the CView-derived class inside the splitter pane has a scrollbar. – Roger Rowland Mar 11 '13 at 16:24
  • I have no enough reputation to insert a picture, please refer to the following link which can show my case: http://a.pictureupload.us/2098357751513f28be4a4c8.png Thank you. – user2157368 Mar 12 '13 at 13:09
  • What are you putting in the splitter panes? Are you using a CScrollView, CEditView, CView, what? – Roger Rowland Mar 12 '13 at 13:15
  • Yes, I use a CRichEditView. How can I avoid the double scrollbars? – user2157368 Mar 12 '13 at 13:16
  • I haven't checked but one way is to override PreCreateWindow() and make sure you remove WS_VSCROLL from the window style. Maybe you also need to look at the size of your view with respect to the size of the splitter pane. – Roger Rowland Mar 12 '13 at 13:23
  • Finally I didn't find a solution for this. I used SetScrollStyle(0) to hide the scrolllbar for the splitter window. But I have a new issue now. How can I split the window now? I cannot split the window by double clicking the up-right corner of the scrollbar, because the scrollbar is hidden now. I'd like use a command from menu to split the window. Which API should I use to split the window. By the way, I used a dynamic view. – user2157368 Mar 14 '13 at 12:05

1 Answers1

0

The scroll bar is created with respected to the style given on creation of splitter window. Please refer the following link

https://learn.microsoft.com/en-us/cpp/mfc/reference/csplitterwnd-class?view=msvc-170#create

if the style is modified as below, the scrollbars will not be created

DWORD dwStyle = WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT.

To show the Splitter for dynamic split, we need the scrollbars which creates space to display the splitter.