Solved

Draw a scroll bar into non-client area

Posted on 1998-07-16
4
977 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
deburging in oracle form 12 105
Change owner from userA to server Local Administrators 7 66
NotAlone Challenge 20 85
noX challenge 17 130
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 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