Solved

Draw a scroll bar into non-client area

Posted on 1998-07-16
4
986 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

623 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