Solved

CSliderCtrl OwnerDraw

Posted on 1998-05-19
8
826 Views
Last Modified: 2013-11-20
I subclassed CSliderCtrl with my new control CMySliderCtrl and I attempt to do OwnerDraw on it (change the thumb and background) but the control seems to never get in overriden OnDraw function member. I want explanation. Thanks in advance.
0
Comment
Question by:fmichaud061597
  • 4
  • 4
8 Comments
 
LVL 11

Expert Comment

by:mikeblas
ID: 1312940
Slider controls don't support owner draw.  There's nothing to explain: the control just doesn't do it.

.B ekiM

0
 

Author Comment

by:fmichaud061597
ID: 1312941
What is your suggestion?
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1312942
Sorry, I didn't see that you asked a multi-part question.

You have three choices:

1) Subclass the control and handle WM_PAINT yourself. If you need to paint some easy adornment, or some small extra shape, this is fine. Call the control's OnPaint() handler, and let it paint the control. Then, paint over what the control painted. The control double-buffers everything it paints, which means that if your painting routine is slow, you'll end up seeing flashing or flickering--especially while the user hot-tracks the control. If you

2) Subclass the control and completely paint the control yourself. This is lots more work than 1), but gives you far more control over exactly the way the control will look. You can draw any part of the control without worrying about ligning up with the way the control draws under all circumstances on every system.

3) Find a 3rd-party control that gives source code or has better provisions for owner draw.

.B ekiM


0
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.

 

Author Comment

by:fmichaud061597
ID: 1312943
It is the first time I have to do that, so what is the exact procedures for your choice 2? It's fine to subclass the control but after, what should I override and how to invoke the custom drawing and where?
0
 

Author Comment

by:fmichaud061597
ID: 1312944
I have successfully drawn on the control, but the thumb have it's default RECT. How do I change this rect to a better one. There is only the member GetThumbRect().
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1312945
You can draw in whatever rect you like: I don't know how you would define "better" for what you want to draw for the thumb. You don't have to draw in the rect returned by GetThumbRect().

.B ekiM
0
 

Author Comment

by:fmichaud061597
ID: 1312946
I have to define my new thumb, and when the left mouse button is down it should track with it, but actually the thumb seems to have kept his old rect. The result is that when I want to track it I must click on a tiny area instead of my new bitmap.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 1312947
Good luck with your project.

.B ekiM

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 152
ODBC Connection Logging, ADO.NET 6 69
Expand macro to ask for filename column 8 37
isEverywhere  challenge 19 82
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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