Solved

Draw a scroll bar into non-client area

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumNumber challenge 16 99
move a line in eclipse 3 60
Thin secure Windows 10 5 48
unix example issues 18 47
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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

18 Experts available now in Live!

Get 1:1 Help Now