Solved

CScrollView scrollbar visible?

Posted on 2002-03-11
5
901 Views
Last Modified: 2013-11-20
I'm using a CScrollView and would like to know if the horizontal and vertical scrollbars are currently visible. Anyone know how to do this?
0
Comment
Question by:zeekial
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6855751
Hmm, you could try

DWORD dwStyle = GetWindowLong ( pScrollView->m_hWnd, GWL_STYLE);

if ( dwStyle | WS_HSCROLL) {

 // has horiz. bar
}

if ( dwStyle | WS_VSCROLL) {

 // has vert. bar
}
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 6855803
SCROLLINFO info;
info.cbSize = sizeof(SCROLLINFO);
info.fMask = SIF_TRACKPOS;

if ( ::GetScrollInfo(m_hWnd, SB_HORZ, &info) )
{
     // scrollbar there
}
else
{
     // no scrollbar available
}

GOOD LUCK
0
 

Author Comment

by:zeekial
ID: 6856851
roshmon and jkr,

Here's more specifics on what I'm trying to do. I'm diplaying a bitmap image(CScrollView) in an MDI child window. I would like to constrain the user from sizing the CMDIChildWnd beyond the edge of the displayed bitmap. To do this I'm using the OnGetMinMaxInfo handler in the CMDIChildWnd.  The problem is when the scrollbars are displayed the constrained size must be increased otherwise the scroll bars will obscure the edges of the view. I've tried both of the previous comments and style is always reported as true even if the bars are not displayed.

Regards,
zeekial
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10371478
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ refund points
Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

AndyAinscow
EE Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10417530
PAQed, with points refunded (300)

modulo
Community Support Moderator
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now