15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Hiding the scrollbars from CScrollView ?

Danny Lauwers -- dlauwers@innet.be
Thursday, June 06, 1996

NT4.0b2 / VC++4.1 / MFC4

Hello,

I want to use two CScrollViews, one that has HORZ and VERT scrollbars and
the other that has no scrollbars. I want to link both views (in both ways)
for scrolling without using the CSplitterWnd (They have an option for that,
but I have my reasons). As the user drags the mouse from somewhere in the
view to the bottom, the view has to scroll in that direction (I can use
OnMouseMove for that..) and the first scrollview has to follow, the same for
the other view with the scrollbar, the other has to follow. Now it seems
that the scrollbars from a CScrollView are no controls but default 'windows'
scrollbars. I have tried ShowScrollBar(SB_BOTH,FALSE) or the win API variant
with the m_hWnd parameter. Nothing seems to hide the scrollbars. I can't use
the GetScrollBarCtrl function because there are no ctrls to get ! The MFC
functions just checks on WS_??? (something) and returns NULL.

Must I use a CView instead and make my own CScrollBarCtrl to move both
views. I tried out a bit, and scrolling is not direct a problem, but my
buttons doesn't stay against the bottom or the right-side of my CMDIChildWnd
derived class. I have given some SB_??? parameters to tell the control to
stay against the side of the frame, but they don't seem to act accordingly.

An other alternative is of course to use the CView with two CScrollBars and
doing all the repositioning and sizing myself !!

Does anybody has any idea's or comment on this !!

Thanks for any answers
Danny Lauwers

==========================================================
Ing. Danny Lauwers (dlauwers@innet.be)
Intersoft Electronics
Lammerdries 27
2250 Olen Belgium Europe
Tel: +32 14 231811
Fax: +32 14 231944
----------------------------------------------------------
 Radar verification Hard- & software
 Fotofinish and timing of sportevents
 Footscan applications
 and more ...
==========================================================




Greg D. Tighe -- gdt@eng.aisinc.com
Monday, June 10, 1996

> NT4.0b2 / VC++4.1 / MFC4
> 
> Hello,
> 
> I want to use two CScrollViews, one that has HORZ and VERT scrollbars and
> the other that has no scrollbars.

Have you tried the following (from within your view which is to have 
no scrollbars:)

 SetScrollRange (SB_HORZ, 0, 0, TRUE);
 SetScrollRange (SB_VERT, 0, 0, TRUE);

	-Greg Tighe
	Applied Intelligent Systems, Inc.
	Ann Arbor, MI
	gdt@aisinc.com



Roger Onslow -- Roger_Onslow@compsys.com.au
Tuesday, June 11, 1996

CScrollView calls CScrollView::UpdateBars automatically from
SetScrollSizes and (default) OnSize to create and update the
scrollbars (by calling CWnd::EnableScrollBarCtrl etc).  Note
that the scroll bars are siblings to the view (ie also owned by the
frame).

If UpdateBars had been made virtual , you could override it,
but unfortunately, like many MFC routines that could have useful
overrides, it wasn't.

However you can supply you own OnSize, which could
call you own UpdateBars (copied from CScrollView implementation)
with the appropriate changes you require for removing scroll bars.

As far as SetScrollSizes, this is (usually) only called once, and you
could always follow it with a call to OnSize which would the call your
new UpdateBars routing (or again, copy the implementation from
CScrollView and change it to call your new routine)

Roger Onslow






| Вернуться в корень Архива |