Solved

Draw a scroll bar into non-client area

Posted on 1998-07-16
4
965 Views
Last Modified: 2013-11-20
How can I draw a standard scrollbar in the non-client area of my CWnd derived class ?
I try to create a scrollbar child control but it is never refreshed.
I don't want to draw the entire scoll bar myself in the OnNcPaint handler...
0
Comment
Question by:chabaud
  • 2
4 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1319293
What about calling Invalidate and UpdateWindow for the scrool bar in the OnNcPaint handler?
0
 
LVL 3

Accepted Solution

by:
danny_pav earned 100 total points
ID: 1319294
I asked the same question.  It is at:
http://www.experts-exchange.com/topics/comp/os-ms-windows/programming/owl/Q.10051718

The summary:
First of all, a child window is confined to its parent windows CLIENT area.  So a child window definitly will not work.

There are three ways around this.  

First, you might be able to get around this using a pop-up window.  That is, a window that doesn't specify the WS_CHILD and that specifies the other window as an owner.  You would have to move and size this pop-up window whenever the owner window is moved or sized.  Big pain in the ass.

Second, rather than increasing the size of the non-client area, you could put the control in the client area and draw things so that it appears to be in the non-client area.  This may not be possible depending on the geometry of the situation however.

Third, impliment them "brute force".  You draw the button "manually" when the window gets the non-client paint message.  You indicate a hit on the button by handling the non-client hit test message.  You react to the button being pressed on a non-client mouse down message witht he appropriate hit test value.  

0
 
LVL 4

Author Comment

by:chabaud
ID: 1319295
Thanks a lot, it was my first participation to experts-exchange and not the last !
0
 
LVL 3

Expert Comment

by:danny_pav
ID: 1319296
You might want to thank nietod, who gave the answer that I summarized.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 177
ODBC Connection Logging, ADO.NET 6 56
firstChar challenge 13 110
wordappend challenge 8 147
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

16 Experts available now in Live!

Get 1:1 Help Now