Hiding Scrollbars in CScrollView/CSplitterWnd
David Halpin -- dhalpin@macromedia.com
Wednesday, December 18, 1996
Environment: VC++ 4.2b, Win 95, NT 4.0
Dear Fellow MFC Developers:
I have created a static CSplitterWnd with 4 panes. I want each of the
panes to have a scrolling area that is larger than the actual client area
shown in the splitter pane window. Thus, each of the panes will contains a
CScrollView derived view. However, I do not want each of the panes to
contain a scroll bar. How can I hide the scroll bars that are created by
the CScrollView objects in addition to any scroll bars that the
CSplitterWnd makes?
These are the things I have tried thus far:
1.> SetScrollSize - SetScrollSize sets the scrollable area of the scroll
view. If the scroll size is larger than the client area, then the
scrollbars appears. If I set the scroll sizes the same size as the client
area, then the scroll bars do not show. This defeats the point of having a
scroll view. Thus did not work.
2.> OnPreCreateWindow - I turned off the WS_HSCROLL and WS_VSCROLL flags
in the CREATESTRUCT to try and eliminate the scroll bars when the views are
created. This did not work.
3.> ShowScrollBar - I tried to use ShowScrollBar(SB_BOTH, FALSE) to
elmininate the scroll bars. I called this after creating the views and
during each of the views OnDraw methods. This did nothing.
4.> GetScrollBarCtrl - I tried to get the scroll bar control from the views
and call ShowScrollBar on each of them. This did nothing.
5.> CSplitterWnd & CScrollView - I looked into overriding many of the
member functions of these classes after reading the source code and
stepping through a bunch of functions. No good solution came about.
Obviously, since this is an advanced MFC list., I assumed everyone is
expected to do background work BEFORE submitting a question. I believe
this is an advanced question. A good implementation of this could be used
in may situations. In fact, I saw an earlier e-mail from someone who
wanted to draw some rulers in their view and have the rulers scroll with
the contents of the view. I have not seen a response to his message yet.
Because this is an advanced MFC list, I assume specific things:
1.> Responses to messages have been thought through, and are not just the
everyday average thing I should have tried before I sent this mail to the
list. (Unless you are sure it will work)
2.> You have not tried the basic ideas you proposed or are not familiar
with the subject at hand.
3.> I keep my messages brief so you don't have to read all the overhead to
get to the question. I don't think there is a need for a lot of fluff
because, once again, "This is an advanced list". I have had problems
getting my messages past the moderator because they are to small.
Therefore, assuming that I have not thought the problem out and completed
the necessary research.
Sorry, about the above. But, I had to say something. I enjoy the list and
am looking for it to maintain and improve on it's "Advanced" assistance.
Therefore, any "qualified" responses would be greatly appreciated.
Thanks
David
dhalpin@macromedia.com
"Lotteries are a tax on people who don't understand statistics."
"It is better to beg for forgiveness than ask for permission."
---------------------------------------------------------------------------
This email is only for the use of the addressee. It may contain information
which is legally privileged, confidential and exempt from disclosure.
If you are not the intended recipient you are hereby notified that any
dissemination, distribution, or copying of this communication and its
attachments is strictly prohibited. If you receive this communication in
error, please email dhalpin@macromedia.com
---------------------------------------------------------------------------
David Lantsman -- davidlan@il.lucky.net
Friday, December 20, 1996
Hello,
In order to hide a scroll bar you should set it's range to 0-0:
SetScrollRange(SB_VERT /* or SB_HORZ */ , 0, 0, FALSE);
It'll make it hidden.
Goodbye,
David Lantsman
P.S.
You can check in the same way whether the scroll bar is visible -
check it's range.
----------
From: David Halpin[SMTP:dhalpin@macromedia.com]
To: mfc-l@netcom.com
Subject: Hiding Scrollbars in CScrollView/CSplitterWnd
Environment: VC++ 4.2b, Win 95, NT 4.0
Dear Fellow MFC Developers:
I have created a static CSplitterWnd with 4 panes. I want each of the
panes to have a scrolling area that is larger than the actual client area
shown in the splitter pane window. Thus, each of the panes will contains a
CScrollView derived view. However, I do not want each of the panes to
contain a scroll bar. How can I hide the scroll bars that are created by
the CScrollView objects in addition to any scroll bars that the
CSplitterWnd makes?
| Вернуться в корень Архива
|